How Can I Get Live Location In Telegram Bot Via Python?
I'm using the python-telegram-bot library. I want to track a user's Live Location, but I don't know how to do it. I try to use Job Queue: def notification(bot, job): updates = bo
Solution 1:
Just to ellaborate on Seans answer:
It can be done quite easily using the python-telegram-bot library. Whenever the location did update it can be found in update.edited_message
. This only works if the user is manually sharing live location with the bot of course.
deflocation(bot, update):
message = Noneif update.edited_message:
message = update.edited_message
else:
message = update.message
current_pos = (message.location.latitude, message.location.longitude)
location_handler = MessageHandler(Filters.location, location)
dispatcher.add_handler(location_handler)
Solution 2:
Your updates should look like this.
It will only contain first location in .message.location
, the latest location is .edit_message.location
, and others will be gone, so you need to record yourself.
Post a Comment for "How Can I Get Live Location In Telegram Bot Via Python?"