电报机器人位置python

时间:2017-04-15 09:51:12

标签: python location bots telegram

如何使用电报机器人从用户获取位置?我试过这个:

location_keyboard = KeyboardButton(text="send_location",  request_location=True)           
contact_keyboard = KeyboardButton(text ='Share contact', request_contact=True) 
custom_keyboard = [[ location_keyboard], [contact_keyboard ]]

1 个答案:

答案 0 :(得分:1)

您需要执行以下操作:

使用以下参数调用sendMessage函数:

{
 chat_id : 1234,
 text: "your message",
 reply_markup: 
  {keyboard: 
    [
      [{text: "Send Your Mobile", request_contact: true}],
      [{text: "Send Your Location", request_location: true}]
    ]
  }
}