Skip to main content
 首页 » 编程设计

python之Telegram Bot 位置 python

2025年02月15日7zfyouxi

如何使用 Telegram Bot 从用户那里获取位置信息?我试过这个:

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

请您参考如下方法:

您需要执行以下操作:

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

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