From 47b25b0e2df98f57ce2a196da0ca716d29a03ad0 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 11:35:53 +0100 Subject: [PATCH 1/2] CallbackQuery must deal with bytes instead of strings --- pyrogram/client/ext/utils.py | 2 +- pyrogram/client/types/bots/callback_query.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index b803c077..fac611f3 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -905,7 +905,7 @@ def parse_callback_query(client, update, users): message=message, inline_message_id=inline_message_id, chat_instance=str(update.chat_instance), - data=update.data.decode(), + data=update.data, game_short_name=update.game_short_name, client=client ) diff --git a/pyrogram/client/types/bots/callback_query.py b/pyrogram/client/types/bots/callback_query.py index 843a9bb8..447d13ea 100644 --- a/pyrogram/client/types/bots/callback_query.py +++ b/pyrogram/client/types/bots/callback_query.py @@ -60,7 +60,7 @@ class CallbackQuery(Object): client=None, message=None, inline_message_id: str = None, - data: str = None, + data: bytes = None, game_short_name: str = None ): self._client = client From 1bd41d01389aee7b7c02c765cd05835a60495596 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 11:37:27 +0100 Subject: [PATCH 2/2] Fix CallbackQuery docs --- pyrogram/client/types/bots/callback_query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/types/bots/callback_query.py b/pyrogram/client/types/bots/callback_query.py index 447d13ea..046981b7 100644 --- a/pyrogram/client/types/bots/callback_query.py +++ b/pyrogram/client/types/bots/callback_query.py @@ -43,7 +43,7 @@ class CallbackQuery(Object): Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. - data (``str``, *optional*): + data (``bytes``, *optional*): Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. game_short_name (``str``, *optional*):