Answer the question
In order to leave comments, you need to log in
How to change message in telegram bot?
I ran into a problem changing or deleting messages sent by the bot.
I am asked for the Id of the message to be changed. But where to get it from? and is it possible to set some kind of Id when sending a message?
(Thanks in advance to whoever answers)
Answer the question
In order to leave comments, you need to log in
When a message is sent, a Message object is returned containing the required id.
For example, in telebot:
msg = bot.send_message(my_chat_id, message_text)
msg_id = msg.message_id
bot.edit_message_text(chat_id=my_chat_id, message_id=msg_id, text="(edited) "+message_text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question