K
K
ki ki2019-12-21 10:19:26
Python
ki ki, 2019-12-21 10:19:26

How to get the message_id of a post in a channel published by a bot?

After pressing the 'yes' button, the bot publishes a message on the channel. How to get the message_id of a published message.
I write using the pyTelegramBotAPI library.

@bot.callback_query_handler(func=lambda call: True)
@bot.message_handler(content_types=['text'])
def callback_worker(call):
    if call.data == 'yes':
        bot.send_message(id_chatt,textt)

message.message_id-Produces id-messages from the correspondence, but you need the one message_idsent to the channel.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2019-12-21
@TTATPuOT

And how, in fact, does a message from a LAN differ from a message in a channel?
There is only one difference - the message is transmitted in the "message" field, and the post in the channel in the "channel_post" field. This can be seen from the Update object .
The fields are different, but the object is the same - Message .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question