Fix pack implementations

This commit is contained in:
Lonami Exo 2023-10-17 18:50:06 +02:00
parent 34dffe978e
commit 4465644aa1
3 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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