From 458d220af9643321442baa605aa07a1a34403b68 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 3 Mar 2018 23:41:27 +0100 Subject: [PATCH] Fix users not being set for some events.ChatAction and properties --- telethon/events/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/telethon/events/__init__.py b/telethon/events/__init__.py index 821930a6..fe9fc821 100644 --- a/telethon/events/__init__.py +++ b/telethon/events/__init__.py @@ -525,15 +525,19 @@ class ChatAction(_EventBuilder): elif isinstance(action, types.MessageActionChannelCreate): event = ChatAction.Event(msg.to_id, created=True, + users=msg.from_id, new_title=action.title) elif isinstance(action, types.MessageActionChatEditTitle): event = ChatAction.Event(msg.to_id, + users=msg.from_id, new_title=action.title) elif isinstance(action, types.MessageActionChatEditPhoto): event = ChatAction.Event(msg.to_id, + users=msg.from_id, new_photo=action.photo) elif isinstance(action, types.MessageActionChatDeletePhoto): event = ChatAction.Event(msg.to_id, + users=msg.from_id, new_photo=True) else: return @@ -661,20 +665,16 @@ class ChatAction(_EventBuilder): Might be ``None`` if the information can't be retrieved or there is no user taking part. """ - try: - return next(self.users) - except (StopIteration, TypeError): - return None + if self.users: + return self._users[0] @property def input_user(self): """ Input version of the self.user property. """ - try: - return next(self.input_users) - except (StopIteration, TypeError): - return None + if self.input_users: + return self._input_users[0] @property def users(self):