Queer European MD passionate about IT
Explorar o código

Fixed bug concerning wrong identifier in callback queries

If 'from' in update do not consider update['message']
Davte %!s(int64=5) %!d(string=hai) anos
pai
achega
d6b7b3002e
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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, (