From 4465644aa18d7801845018ab8068b158d584fcd4 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 17 Oct 2023 18:50:06 +0200 Subject: [PATCH] Fix pack implementations --- client/src/telethon/_impl/client/types/chat/channel.py | 2 +- client/src/telethon/_impl/client/types/chat/group.py | 4 +++- client/src/telethon/_impl/client/types/chat/user.py | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/src/telethon/_impl/client/types/chat/channel.py b/client/src/telethon/_impl/client/types/chat/channel.py index f056fd92..b3e723e0 100644 --- a/client/src/telethon/_impl/client/types/chat/channel.py +++ b/client/src/telethon/_impl/client/types/chat/channel.py @@ -61,7 +61,7 @@ class Channel(Chat, metaclass=NoPublicConstructor): if getattr(self._raw, "gigagroup", False) else PackedType.BROADCAST, id=self._raw.id, - access_hash=None, + access_hash=self._raw.access_hash, ) # endregion Overrides diff --git a/client/src/telethon/_impl/client/types/chat/group.py b/client/src/telethon/_impl/client/types/chat/group.py index 719fc220..9a3b03c3 100644 --- a/client/src/telethon/_impl/client/types/chat/group.py +++ b/client/src/telethon/_impl/client/types/chat/group.py @@ -65,7 +65,9 @@ class Group(Chat, metaclass=NoPublicConstructor): return None else: return PackedChat( - ty=PackedType.MEGAGROUP, id=self._raw.id, access_hash=None + ty=PackedType.MEGAGROUP, + id=self._raw.id, + access_hash=self._raw.access_hash, ) # endregion Overrides diff --git a/client/src/telethon/_impl/client/types/chat/user.py b/client/src/telethon/_impl/client/types/chat/user.py index 4a9de6b2..df43b7f3 100644 --- a/client/src/telethon/_impl/client/types/chat/user.py +++ b/client/src/telethon/_impl/client/types/chat/user.py @@ -90,14 +90,14 @@ class User(Chat, metaclass=NoPublicConstructor): return self._raw.username def pack(self) -> Optional[PackedChat]: - if self._raw.access_hash is not None: + if self._raw.access_hash is None: + return None + else: return PackedChat( ty=PackedType.BOT if self._raw.bot else PackedType.USER, id=self._raw.id, access_hash=self._raw.access_hash, ) - else: - return None # endregion Overrides