mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Remove chat field for now, it can be accessed via message.chat
This commit is contained in:
parent
d6bdf5f38b
commit
b8996b1147
@ -161,7 +161,7 @@ class Dispatcher:
|
||||
self.dispatch(
|
||||
pyrogram.Update(
|
||||
callback_query=utils.parse_callback_query(
|
||||
self.client, update, users, chats
|
||||
self.client, update, users
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -59,7 +59,6 @@ class CallbackQuery(Object):
|
||||
self,
|
||||
id: str,
|
||||
from_user,
|
||||
chat,
|
||||
chat_instance: str,
|
||||
message=None,
|
||||
inline_message_id: str = None,
|
||||
@ -68,7 +67,6 @@ class CallbackQuery(Object):
|
||||
):
|
||||
self.id = id # string
|
||||
self.from_user = from_user # User
|
||||
self.chat = chat
|
||||
self.message = message # flags.0?Message
|
||||
self.inline_message_id = inline_message_id # flags.1?string
|
||||
self.chat_instance = chat_instance # string
|
||||
|
@ -723,19 +723,20 @@ def parse_photos(photos):
|
||||
)
|
||||
|
||||
|
||||
def parse_callback_query(client, callback_query, users, chats):
|
||||
if isinstance(callback_query.peer, types.PeerUser):
|
||||
chat = parse_user_chat(users[callback_query.peer.user_id])
|
||||
elif isinstance(callback_query.peer, types.PeerChat):
|
||||
chat = parse_chat_chat(chats[callback_query.peer.chat_id])
|
||||
def parse_callback_query(client, callback_query, users):
|
||||
peer = callback_query.peer
|
||||
|
||||
if isinstance(peer, types.PeerUser):
|
||||
peer_id = peer.user_id
|
||||
elif isinstance(peer, types.PeerChat):
|
||||
peer_id = -peer.chat_id
|
||||
else:
|
||||
chat = parse_channel_chat(chats[callback_query.peer.channel_id])
|
||||
peer_id = int("-100" + str(peer.channel_id))
|
||||
|
||||
return pyrogram_types.CallbackQuery(
|
||||
id=callback_query.query_id,
|
||||
from_user=parse_user(users[callback_query.user_id]),
|
||||
chat=chat,
|
||||
message=client.get_messages(chat.id, callback_query.msg_id),
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user