1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #1229 from Badiboy/master

Fix CallbackQuery issue for games
This commit is contained in:
Badiboy 2021-07-13 20:13:36 +03:00 committed by GitHub
commit 9b56afd569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1160,6 +1160,9 @@ class CallbackQuery(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if json_string is None: return None if json_string is None: return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if not "data" in obj:
# "data" field is Optional in the API, but historically is mandatory in the class constructor
obj['data'] = None
obj['from_user'] = User.de_json(obj.pop('from')) obj['from_user'] = User.de_json(obj.pop('from'))
if 'message' in obj: if 'message' in obj:
obj['message'] = Message.de_json(obj.get('message')) obj['message'] = Message.de_json(obj.get('message'))