Answer the question
In order to leave comments, you need to log in
How to determine the message_id, knowing the channel id and the text of the message?
I am writing a bot in Python using pyTelegramBotAPI.
After a user request, my bot should remove the message from the channel. This site gave me the following:
bot.delete_message(chat_id=message.chat_id,
message_id=message.message_id,
*args,
**kwargs)
Answer the question
In order to leave comments, you need to log in
It is possible to determine message_id but not with 100% probability. Since the message can be duplicated in the channel. To do this, you need to connect to the channel and load its history. For example, using MTProto
When publishing to a channel, the method returns a message_id in response))
But the easiest and most correct way is to send a message from the channel to the bot. Then his ID will arrive exactly in the request
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question