I am making a telegram bot by using python-telegram-bot and I added it to a group.

I want to specify a list, and if the sentences in the list are sent to the group, the 。telegram's robot will delete that message from the group. What modules and codes should I use to do this?

Please give me a full description. I'm new

python telegram-bot python-telegram-bot 597

出处 分享

创建 06 8月. 17 2017-08-06 12:33:36


You can use

bot.DeleteMessageAsync(chatId, messageId)

you should make it in a try catch in case the message doesn't exist anymore or you have a wrong messageId,

messageId is a property which you get in MessageEventArgs.Message,

Note: the chatId should be the Group/Channel chatId and not of the user wh!o sent it, get that in Chat.Id property of MessageEventArgs.Message ...


怎样察看机器人连接的群组? 怎样从群组中删除机器人?


本文网址: http://www.1cm8858.com/d/20201029174859_7824_1427594603/home