0

hi i'd like my python chatbot to be able to get users location. I cannot find code for that -- can u help ?

def testbot_basic():
def handle(msg):
  content_type, chat_type, chat_id = telepot.glance(msg)
  if content_type == 'text':
      bot.sendMessage(chat_id,"ciao sono un Bot")
      print(bot.getMe())
      pprint(bot.getUpdates())

bot = telepot.Bot('xxxxxxxxxxxxx')
print(bot.getMe())
pprint(bot.getUpdates())
#per ogni messaggio ricevuto viene aperta una istanza della funzione handle
bot.message_loop(handle)
print ('Listening ...')
# diamo 10 secondi di pausa
while 1:
    time.sleep(5)

1 Answers1

0

got it

      if content_type == 'location':
      print(msg['location'])
      print(msg['location']['latitude'])
      print(msg['location']['longitude'])