From 0603a0df4ca1261dbcac840fa823198f6bd76d10 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Fri, 3 Jan 2020 17:51:05 +0300 Subject: [PATCH] Update types.py Animation is moved before document to save backward compatibility. content_type = 'document' should override content_type = 'animation' to save previous behaviour. --- telebot/types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index aa54e06..dac9d79 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -287,6 +287,9 @@ class Message(JsonDeserializable): if 'audio' in obj: opts['audio'] = Audio.de_json(obj['audio']) content_type = 'audio' + if 'animation' in obj: + opts['animation'] = Animation.de_json(obj['animation']) + content_type = 'animation' if 'document' in obj: opts['document'] = Document.de_json(obj['document']) content_type = 'document' @@ -296,9 +299,6 @@ class Message(JsonDeserializable): if 'photo' in obj: opts['photo'] = Message.parse_photo(obj['photo']) content_type = 'photo' - if 'animation' in obj: - opts['animation'] = Animation.de_json(obj['animation']) - content_type = 'animation' if 'sticker' in obj: opts['sticker'] = Sticker.de_json(obj['sticker']) content_type = 'sticker'