如何使用电报机器人从用户获取位置?我试过这个:
location_keyboard = KeyboardButton(text="send_location", request_location=True)
contact_keyboard = KeyboardButton(text ='Share contact', request_contact=True)
custom_keyboard = [[ location_keyboard], [contact_keyboard ]]
答案 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}]
]
}
}