1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class CallbackQuery |
9
|
|
|
* This object represents an incoming callback query from a callback |
10
|
|
|
* button in an inline keyboard. |
11
|
|
|
* If the button that originated the query was attached to a message sent by the bot, |
12
|
|
|
* the field message will be present. |
13
|
|
|
* If the button was attached to a message sent via the bot (in inline mode), |
14
|
|
|
* the field inline_message_id will be present. |
15
|
|
|
* Exactly one of the fields data or game_short_name will be present. |
16
|
|
|
* |
17
|
|
|
* @package TelegramBot\Api\Types |
18
|
|
|
*/ |
19
|
|
|
class CallbackQuery extends BaseType |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* {@inheritdoc} |
23
|
|
|
* |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
static protected $requiredParams = ['id', 'from']; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
* |
31
|
|
|
* @var array |
32
|
|
|
*/ |
33
|
|
|
static protected $map = [ |
34
|
|
|
'id' => true, |
35
|
|
|
'from' => User::class, |
36
|
|
|
'message' => Message::class, |
37
|
|
|
'inline_message_id' => true, |
38
|
|
|
'chat_instance' => true, |
39
|
|
|
'data' => true, |
40
|
|
|
'game_short_name' => true |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Unique identifier for this query |
45
|
|
|
* |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $id; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Sender |
52
|
|
|
* |
53
|
|
|
* @var \TelegramBot\Api\Types\User |
54
|
|
|
*/ |
55
|
|
|
protected $from; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. Message with the callback button that originated the query. |
59
|
|
|
* Note that message content and message date will not be available |
60
|
|
|
* if the message is too old |
61
|
|
|
* |
62
|
|
|
* @var \TelegramBot\Api\Types\Message |
63
|
|
|
*/ |
64
|
|
|
protected $message; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Optional. Identifier of the message sent via the bot in inline mode, |
68
|
|
|
* that originated the query. |
69
|
|
|
* |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected $inlineMessageId; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. |
76
|
|
|
* Useful for high scores in games. |
77
|
|
|
* |
78
|
|
|
* @var string |
79
|
|
|
*/ |
80
|
|
|
protected $chatInstance; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Optional. Data associated with the callback button. |
84
|
|
|
* Be aware that a bad client can send arbitrary data in this field. |
85
|
|
|
* |
86
|
|
|
* @var string |
87
|
|
|
*/ |
88
|
|
|
protected $data; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Optional. Short name of a Game to be returned, |
92
|
|
|
* serves as the unique identifier for the game |
93
|
|
|
* |
94
|
|
|
* @var string |
95
|
|
|
*/ |
96
|
|
|
protected $gameShortName; |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
2 |
|
public function getId() |
103
|
|
|
{ |
104
|
2 |
|
return $this->id; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param string $id |
109
|
|
|
*/ |
110
|
3 |
|
public function setId($id) |
111
|
|
|
{ |
112
|
3 |
|
$this->id = $id; |
113
|
3 |
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return User |
117
|
|
|
*/ |
118
|
2 |
|
public function getFrom() |
119
|
|
|
{ |
120
|
2 |
|
return $this->from; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param User $from |
125
|
|
|
*/ |
126
|
3 |
|
public function setFrom(User $from) |
127
|
|
|
{ |
128
|
3 |
|
$this->from = $from; |
129
|
3 |
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return Message |
133
|
|
|
*/ |
134
|
|
|
public function getMessage() |
135
|
|
|
{ |
136
|
|
|
return $this->message; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param Message $message |
141
|
|
|
*/ |
142
|
|
|
public function setMessage($message) |
143
|
|
|
{ |
144
|
|
|
$this->message = $message; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
2 |
|
public function getInlineMessageId() |
151
|
|
|
{ |
152
|
2 |
|
return $this->inlineMessageId; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param string $inlineMessageId |
157
|
|
|
*/ |
158
|
3 |
|
public function setInlineMessageId($inlineMessageId) |
159
|
|
|
{ |
160
|
3 |
|
$this->inlineMessageId = $inlineMessageId; |
161
|
3 |
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
2 |
|
public function getChatInstance() |
167
|
|
|
{ |
168
|
2 |
|
return $this->chatInstance; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param string $chatInstance |
173
|
|
|
*/ |
174
|
3 |
|
public function setChatInstance($chatInstance) |
175
|
|
|
{ |
176
|
3 |
|
$this->chatInstance = $chatInstance; |
177
|
3 |
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return string |
181
|
|
|
*/ |
182
|
2 |
|
public function getData() |
183
|
|
|
{ |
184
|
2 |
|
return $this->data; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param string $data |
189
|
|
|
*/ |
190
|
3 |
|
public function setData($data) |
191
|
|
|
{ |
192
|
3 |
|
$this->data = $data; |
193
|
3 |
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
2 |
|
public function getGameShortName() |
199
|
|
|
{ |
200
|
2 |
|
return $this->gameShortName; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param string $gameShortName |
205
|
|
|
*/ |
206
|
3 |
|
public function setGameShortName($gameShortName) |
207
|
|
|
{ |
208
|
3 |
|
$this->gameShortName = $gameShortName; |
209
|
3 |
|
} |
210
|
|
|
|
211
|
|
|
|
212
|
|
|
|
213
|
|
|
} |
214
|
|
|
|