Core: How to save messages sent to the database

Created on 6 Nov 2017  路  1Comment  路  Source: php-telegram-bot/core

I need to get information about the message sent by the bot. How can I save such messages in the database?

Most helpful comment

After every sendMessage request you can can grab it's result like this:

$result = Request::sendMessage($data);
if ($result->isOk()) {
    $sentMessage = $result->getResult(); //Message object
}

Then you can use DB::getPdo() and make a query to the database and save it there.

>All comments

After every sendMessage request you can can grab it's result like this:

$result = Request::sendMessage($data);
if ($result->isOk()) {
    $sentMessage = $result->getResult(); //Message object
}

Then you can use DB::getPdo() and make a query to the database and save it there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dorcu picture dorcu  路  3Comments

sayjeyhi picture sayjeyhi  路  3Comments

Recouse picture Recouse  路  3Comments

vansanblch picture vansanblch  路  3Comments

ttvd94 picture ttvd94  路  4Comments