2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 12:57:52 +00:00

Add a proxy to the Client instance inside CallbackQuery objects

This commit is contained in:
Dan 2018-10-09 14:07:01 +02:00
parent 7b76751e8f
commit 1be144288c
3 changed files with 8 additions and 4 deletions

View File

@ -205,7 +205,7 @@ class Dispatcher:
self.dispatch(
pyrogram.Update(
callback_query=utils.parse_inline_callback_query(
update, users
self.client, update, users
)
)
)

View File

@ -865,11 +865,12 @@ def parse_callback_query(client, callback_query, users):
message=client.get_messages(peer_id, callback_query.msg_id),
chat_instance=str(callback_query.chat_instance),
data=callback_query.data.decode(),
game_short_name=callback_query.game_short_name
game_short_name=callback_query.game_short_name,
client=client
)
def parse_inline_callback_query(callback_query, users):
def parse_inline_callback_query(client, callback_query, users):
return pyrogram_types.CallbackQuery(
id=str(callback_query.query_id),
from_user=parse_user(users[callback_query.user_id]),
@ -883,7 +884,8 @@ def parse_inline_callback_query(callback_query, users):
),
b"-_"
).decode().rstrip("="),
game_short_name=callback_query.game_short_name
game_short_name=callback_query.game_short_name,
client=client
)

View File

@ -57,11 +57,13 @@ class CallbackQuery(Object):
id: str,
from_user,
chat_instance: str,
client=None,
message=None,
inline_message_id: str = None,
data: str = None,
game_short_name: str = None
):
self._client = client
self.id = id # string
self.from_user = from_user # User
self.message = message # flags.0?Message