forked from pyrogram/pyrogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback_query.py
More file actions
71 lines (59 loc) · 2.91 KB
/
Copy pathcallback_query.py
File metadata and controls
71 lines (59 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api.core import Object
class CallbackQuery(Object):
"""This object represents an incoming callback query from a callback button in an inline keyboard.
If the button that originated the query was attached to a message sent by the bot, the field message
will be present. If the button was attached to a message sent via the bot (in inline mode),
the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
Args:
id (``str``):
Unique identifier for this query.
from_user (:obj:`User <pyrogram.User>`):
Sender.
chat_instance (``str``, *optional*):
Message with the callback button that originated the query. Note that message content and message date will
not be available if the message is too old.
message (:obj:`Message <pyrogram.Message>`, *optional*):
Identifier of the message sent via the bot in inline mode, that originated the query.
inline_message_id (``str``):
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 associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
game_short_name (``str``, *optional*):
Short name of a Game to be returned, serves as the unique identifier for the game.
"""
ID = 0xb0700024
def __init__(
self,
id: str,
from_user,
chat_instance: str,
message=None,
inline_message_id: str = None,
data: str = None,
game_short_name: str = None
):
self.id = id # string
self.from_user = from_user # User
self.message = message # flags.0?Message
self.inline_message_id = inline_message_id # flags.1?string
self.chat_instance = chat_instance # string
self.data = data # flags.2?string
self.game_short_name = game_short_name # flags.3?string