Telegram-bot-sdk: How send live location?

Created on 21 Nov 2020  路  2Comments  路  Source: irazasyed/telegram-bot-sdk

How command?

All 2 comments

Sending a live location is supported since v3.0, and works in three parts:

  1. Sending the initial location with a live_period (see API docs and Telegram docs)

    $locationMsg = $bot->sendLocation([
       'chat_id' => $chat,
       'latitude' => $lat,
       'longitude' => $lng,
       'live_period' => 3600 // One hour
    ]);
    
  2. Updating the location (not in API docs, see Telegram docs)

    ```php
    $bot->editMessageLiveLocation([
    'chat_id' => $chat,
    'message_id' => $locationMsg->messageId,
    'latitude' => $lat,
    'longitude' => $lng,
    ]);

  3. (optionally) Ending the live location early (not in API docs, see Telegram docs)

    $bot->stopMessageLiveLocation([
       'chat_id' => $chat,
       'message_id' => $locationMsg->messageId
    ]);
    

Tell me.
How to read the live location of the lat long position change sent by the user to the bot?

User -> sendLiveLocations -> Telegram bot -> how to read changes?

$this->update->getEditedMessage()

how to work this code?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maminbajand picture maminbajand  路  4Comments

danilopinotti picture danilopinotti  路  3Comments

chaskayu picture chaskayu  路  4Comments

behnamazimi picture behnamazimi  路  4Comments

jahanzaibbahadur picture jahanzaibbahadur  路  4Comments