简体   繁体   English

Python Telegram Bot delete_message (aiogram)

[英]Python Telegram Bot delete_message (aiogram)

I need to delete messages sent by the bot, and to achieve this I have to use the parameters chat_id and message_id .我需要删除机器人发送的消息,为此我必须使用参数chat_idmessage_id For chat_id I easily use message.chat.id , but I don't know how to get message_id对于 chat_id 我很容易使用message.chat.id ,但我不知道如何获取message_id

If I use bot.send_message(message.chat.id, 'Hello!')如果我使用bot.send_message(message.chat.id, 'Hello!')

How can I get message_id from this message, or how can I delete it如何从此消息中获取message_id ,或者如何将其删除

according to the telegram api the send message function returns an updates value, which you can use to get the message id根据电报 api发送消息 function 返回更新值,您可以使用它来获取消息 ID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM