You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bot.command("start",ctx=>{returnctx.reply("Please share your location",Markup.keyboard([Markup.button.locationRequest("Share location"),]).oneTime().resize(),)})
But then I don't know how to actually get that location when the user presses the button.
I tried using the following handler, but that doesn't get called when the user presses the button.
bot.on(message("location"),ctx=>{const{ latitude, longitude }=ctx.message.locationconsole.log({ latitude, longitude })returnctx.reply("Thanks for sharing your location.",)})
Edit
Also, I understood that when your bot can receive and respond to inline queries, that then you can ask @Botfather with the /setinlinegeo command to ask permission to the user to get their location data for every inline query. And so how I understand this, is that the user gives permission only once and that then the bot can get the (updated?) location data on every query.
Is there a way to achieve the same for a normal bot? That I only ask permission once and that from then on, I can get their location data any time I want?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So I have this:
But then I don't know how to actually get that location when the user presses the button.
I tried using the following handler, but that doesn't get called when the user presses the button.
Edit
Also, I understood that when your bot can receive and respond to inline queries, that then you can ask @Botfather with the
/setinlinegeo
command to ask permission to the user to get their location data for every inline query. And so how I understand this, is that the user gives permission only once and that then the bot can get the (updated?) location data on every query.Is there a way to achieve the same for a normal bot? That I only ask permission once and that from then on, I can get their location data any time I want?
Beta Was this translation helpful? Give feedback.
All reactions