Skip to content

Commit

Permalink
Fix pack implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Oct 17, 2023
1 parent 34dffe9 commit 4465644
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/telethon/_impl/client/types/chat/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def pack(self) -> Optional[PackedChat]:
if getattr(self._raw, "gigagroup", False)
else PackedType.BROADCAST,
id=self._raw.id,
access_hash=None,
access_hash=self._raw.access_hash,
)

# endregion Overrides
4 changes: 3 additions & 1 deletion client/src/telethon/_impl/client/types/chat/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def pack(self) -> Optional[PackedChat]:
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
Expand Down
6 changes: 3 additions & 3 deletions client/src/telethon/_impl/client/types/chat/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ def username(self) -> Optional[str]:
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

Expand Down

0 comments on commit 4465644

Please sign in to comment.