def cmd_location(bot, update):
chat_id = update.message.chat_id
pref = prefs.get(chat_id)
if chat_id not in jobs:
bot.sendMessage(chat_id, text='You have no active scanner.')
return
user_location = update.message.location
# We set the location from the users sent location.
pref.set('location', [user_location.latitude, user_location.longitude, location_radius])
logger.info('[%s] Setting scan location to Lat %s, Lon %s, R %s' % (chat_id,
pref['location'][0], pref['location'][1], pref['location'][2]))
# Send confirmation nessage
bot.sendMessage(chat_id, text="Setting scan location to: %f / %f with radius %.2f m" %
(pref['location'][0], pref['location'][1], 1000*pref['location'][2]))
评论列表
文章目录