Reputation: 23
The bot sends a message to the telegram channel, how to get the id of the same message from the chat, in order to send a reply to it, thus forming a comment?
Upvotes: 1
Views: 9379
Reputation: 66
When you send the message:
await message.answer("Hello") # Or any way
You can just use variables:
msg = await message.answer("Hello")
print(msg)
print(msg["message_id"]) # to get only message id
Output:
{"message_id": 7134, "from": {"id": %ur bot id%, "is_bot": true, "first_name": "Test v1.0", "username": "test_Bot"}, "chat": {"id": %id of the chat%, "first_name": %users first name%, "last_name": %users last name%, "username": %users username%, "type": "private"}, "date": 1657035057, "text": "Hello"}
7134
Upvotes: 2