Track live location in the background of a Telegram Bot via Python

Viewed 559

I am using the library: python-telegram-bot I'd like to do track live location with a /where commmand. First of all, I've send the live location but I don't know how to track location after a few minutes with a /where command. Up to now, this is what I have:

def where(update, context):
    message = None
    if update.edited_message:
        message = update.edited_message
    else:
        message = update.message
    location = message.location.latitude, message.location.longitude

    context.bot.send_message( chat_id=update.message.chat_id, text=str(location))

dispatcher.add_handler(MessageHandler(Filters.location, where))

The problem is that this returns my updated coordinates everytime I move since I sent the location, not when I do the /where command.

0 Answers
Related