diff --git a/pyproject.toml b/pyproject.toml index 9ffe0238..15f7f793 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "royalnet-telethon" -version = "0.1.4" +version = "0.1.5" description = "A Telethon-based frontend for the royalnet.engineer module." authors = ["Stefano Pigozzi "] license = "AGPL-3.0-or-later" diff --git a/royalnet_telethon/pda.py b/royalnet_telethon/pda.py index aa253ce0..4d862b61 100644 --- a/royalnet_telethon/pda.py +++ b/royalnet_telethon/pda.py @@ -87,11 +87,17 @@ class TelethonPDA: if self.mode == TelethonPDAMode.GLOBAL: return None elif self.mode == TelethonPDAMode.USER: - return event.from_id.user_id + if event.from_id: + return event.from_id.user_id + else: + return event.peer_id.user_id elif self.mode == TelethonPDAMode.CHAT: return event.chat_id elif self.mode == TelethonPDAMode.CHAT_USER: - return event.chat_id, event.from_id.user_id + if event.from_id: + return event.chat_id, event.from_id.user_id + else: + return event.chat_id, event.peer_id.user_id else: raise TypeError("Invalid mode")