Skip to content

How can i get id of last sended message by bot? #496

Answered by Lukasss93
Adevald asked this question in Q&A
Discussion options

You must be logged in to vote

The sendMessage method returns a Message object. Just use this object to get what you want:

$message = $bot->sendMessage('Hello!');

// option 1
$bot->deleteMessage($message->chat->id, $message->message_id);

// option 2
$message->delete();

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bogdasari4
Comment options

@Lukasss93
Comment options

Answer selected by Adevald
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants