From d6b7b3002e9f40082309d3c23051f526a81980b6 Mon Sep 17 00:00:00 2001 From: Davte Date: Fri, 12 Jul 2019 14:40:35 +0200 Subject: [PATCH] Fixed bug concerning wrong identifier in callback queries If 'from' in update do not consider update['message'] --- davtelepot/bot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/davtelepot/bot.py b/davtelepot/bot.py index b831251..222b07c 100644 --- a/davtelepot/bot.py +++ b/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, (