Queer European MD passionate about IT
Ver código fonte

Fixed bug concerning wrong identifier in callback queries

If 'from' in update do not consider update['message']
Davte 5 anos atrás
pai
commit
d6b7b3002e
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      davtelepot/bot.py

+ 6 - 0
davtelepot/bot.py

@@ -1481,6 +1481,12 @@ class Bot(TelegramBot, ObjectWithDatabase):
         assert identifier is not None, (
             "Provide a user_id or update object to get a user identifier."
         )
+        if (
+            isinstance(identifier, dict)
+            and 'message' in identifier
+            and 'from' not in identifier
+        ):
+            identifier = identifier['message']
         if isinstance(identifier, dict) and 'from' in identifier:
             identifier = identifier['from']['id']
         assert type(identifier) is int, (