From 6c20f8a2c722fca1b2f811d4f06ea5480ec6d945 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 28 May 2018 18:27:44 +0200 Subject: [PATCH] Set is private/group=True for messages deleted out of channels --- telethon/events/messagedeleted.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/telethon/events/messagedeleted.py b/telethon/events/messagedeleted.py index 4116f852..cbbac8cd 100644 --- a/telethon/events/messagedeleted.py +++ b/telethon/events/messagedeleted.py @@ -29,5 +29,12 @@ class MessageDeleted(EventBuilder): super().__init__( chat_peer=peer, msg_id=(deleted_ids or [0])[0] ) + if peer is None: + # If it's not a channel ID, then it was private/small group. + # We can't know which one was exactly unless we logged all + # messages, but we can indicate that it was maybe either of + # both by setting them both to True. + self.is_private = self.is_group = True + self.deleted_id = None if not deleted_ids else deleted_ids[0] self.deleted_ids = deleted_ids