formapro/telegram-bot-php

Get Live Location

Closed this issue · 6 comments

Hi!
I would to implement the possibility to send the current location of the user by the BOT and I would to save it in a DB.

Do you know which is the best way to do it?

according to the bot api you have to use request_location keyboard button.

https://core.telegram.org/bots/api#keyboardbutton

This part is not implemented yet but should be fairly easy to add, just like request_contacts

I tried it but it is for one-time request...not for live location...right?

I dont know

I found the solution:
$data = $telegram->getData(); $position = $data["edited_message"]["location"];
$lat = $position["latitude"];
$lon = $position["longitude"];

It would be great if you could open a PR with these additions. Would you?

Does it work?