From 3be981ada10f187d29bccdbb7ea09623549cc488 Mon Sep 17 00:00:00 2001 From: trenoduro Date: Tue, 11 May 2021 10:45:55 +0200 Subject: [PATCH] Improved deleted message handling (#645) * Tidy up namings of invite link methods * Improved deleted message handling Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com> --- pyrogram/handlers/deleted_messages_handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyrogram/handlers/deleted_messages_handler.py b/pyrogram/handlers/deleted_messages_handler.py index dff1ebe7..e41158f9 100644 --- a/pyrogram/handlers/deleted_messages_handler.py +++ b/pyrogram/handlers/deleted_messages_handler.py @@ -52,4 +52,10 @@ class DeletedMessagesHandler(Handler): super().__init__(callback, filters) async def check(self, client: "pyrogram.Client", messages: List[Message]): - return await super().check(client, messages[0]) if messages else False # The messages list can be empty + # Every message should be checked, if at least one matches the filter True is returned + # otherwise, or if the list is empty, False is returned + for message in messages: + if await super().check(client, message): + return True + else: + return False