1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

🐛 Fix dispenser key selection

This commit is contained in:
Steffo 2021-04-03 18:38:22 +02:00
parent 6cfdd93af2
commit f2029a484e
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "royalnet-telethon" name = "royalnet-telethon"
version = "0.1.4" version = "0.1.5"
description = "A Telethon-based frontend for the royalnet.engineer module." description = "A Telethon-based frontend for the royalnet.engineer module."
authors = ["Stefano Pigozzi <me@steffo.eu>"] authors = ["Stefano Pigozzi <me@steffo.eu>"]
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"

View file

@ -87,11 +87,17 @@ class TelethonPDA:
if self.mode == TelethonPDAMode.GLOBAL: if self.mode == TelethonPDAMode.GLOBAL:
return None return None
elif self.mode == TelethonPDAMode.USER: 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: elif self.mode == TelethonPDAMode.CHAT:
return event.chat_id return event.chat_id
elif self.mode == TelethonPDAMode.CHAT_USER: 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: else:
raise TypeError("Invalid mode") raise TypeError("Invalid mode")