M
M
Mushro2019-11-23 19:50:29
1C-Bitrix
Mushro, 2019-11-23 19:50:29

Telegram Bot node.js - How to delete all bot messages?

The task is this: I need to delete all messages in telegrams, including the messages of the bot itself, when the button is pressed. There is a button.
How can this be implemented?
I am using node-telegram-bot-api.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ainur Valiev, 2018-11-30
@vaajnur

bitrix loves cp-1251

Z
Zudwa, 2019-11-28
@pembrock

To do this, you need to store all the message_id from the chat.
https://core.telegram.org/bots/api#deletemessage
That is, in theory, your bot can hang in the chat and save the id of all messages somewhere, after which, when you click the button, try to delete them using the deleteMessage method (look at documentation of the conditions under which this is possible)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question