更新时间:2023-11-19 12:26:22
只需要在Seans上进行ellaborate回答:使用 python-telegram-bot 库可以很容易地完成.每当位置更新时,都可以在 update.edited_message
中找到.当然,只有在用户手动与漫游器共享实时位置的情况下,此方法才起作用.
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.
def location(bot, update):
message = None
if 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)