1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\TypeInterface; |
7
|
|
|
use TelegramBot\Api\Types\Inline\ChosenInlineResult; |
8
|
|
|
use TelegramBot\Api\Types\Inline\InlineQuery; |
9
|
|
|
use TelegramBot\Api\Types\Payments\Query\PreCheckoutQuery; |
10
|
|
|
use TelegramBot\Api\Types\Payments\Query\ShippingQuery; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Update |
14
|
|
|
* This object represents an incoming update. |
15
|
|
|
* Only one of the optional parameters can be present in any given update. |
16
|
|
|
* |
17
|
|
|
* @package TelegramBot\Api\Types |
18
|
|
|
*/ |
19
|
|
|
class Update extends BaseType implements TypeInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* {@inheritdoc} |
23
|
|
|
* |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
static protected $requiredParams = ['update_id']; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
* |
31
|
|
|
* @var array |
32
|
|
|
*/ |
33
|
|
|
static protected $map = [ |
34
|
|
|
'update_id' => true, |
35
|
|
|
'message' => Message::class, |
36
|
|
|
'edited_message' => Message::class, |
37
|
|
|
'channel_post' => Message::class, |
38
|
|
|
'edited_channel_post' => Message::class, |
39
|
|
|
'inline_query' => InlineQuery::class, |
40
|
|
|
'chosen_inline_result' => ChosenInlineResult::class, |
41
|
|
|
'callback_query' => CallbackQuery::class, |
42
|
|
|
'shipping_query' => ShippingQuery::class, |
43
|
|
|
'pre_checkout_query' => PreCheckoutQuery::class, |
44
|
|
|
'poll_answer' => PollAnswer::class, |
45
|
|
|
'poll' => Poll::class, |
46
|
|
|
]; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* The update‘s unique identifier. |
50
|
|
|
* Update identifiers start from a certain positive number and increase sequentially. |
51
|
|
|
* This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or |
52
|
|
|
* to restore the correct update sequence, should they get out of order. |
53
|
|
|
* |
54
|
|
|
* @var integer |
55
|
|
|
*/ |
56
|
|
|
protected $updateId; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Optional. New incoming message of any kind — text, photo, sticker, etc. |
60
|
|
|
* |
61
|
|
|
* @var Message |
62
|
|
|
*/ |
63
|
|
|
protected $message; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var PollAnswer |
67
|
|
|
*/ |
68
|
|
|
protected $pollAnswer; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @var Poll |
72
|
|
|
*/ |
73
|
|
|
protected $poll; |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Optional. New version of a message that is known to the bot and was edited |
78
|
|
|
* |
79
|
|
|
* @var Message |
80
|
|
|
*/ |
81
|
|
|
protected $editedMessage; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Optional. New incoming channel post of any kind — text, photo, sticker, etc. |
85
|
|
|
* |
86
|
|
|
* @var Message |
87
|
|
|
*/ |
88
|
|
|
protected $channelPost; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Optional. New version of a channel post that is known to the bot and was edited |
92
|
|
|
* |
93
|
|
|
* @var Message |
94
|
|
|
*/ |
95
|
|
|
protected $editedChannelPost; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Optional. New incoming inline query |
99
|
|
|
* |
100
|
|
|
* @var \TelegramBot\Api\Types\Inline\InlineQuery |
101
|
|
|
*/ |
102
|
|
|
protected $inlineQuery; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Optional. The result of a inline query that was chosen by a user and sent to their chat partner |
106
|
|
|
* |
107
|
|
|
* @var \TelegramBot\Api\Types\Inline\ChosenInlineResult |
108
|
|
|
*/ |
109
|
|
|
protected $chosenInlineResult; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Optional. New incoming callback query |
113
|
|
|
* |
114
|
|
|
* @var \TelegramBot\Api\Types\CallbackQuery |
115
|
|
|
*/ |
116
|
|
|
protected $callbackQuery; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Optional. New incoming shipping query. Only for invoices with flexible price |
120
|
|
|
* |
121
|
|
|
* @var ShippingQuery |
122
|
|
|
*/ |
123
|
|
|
protected $shippingQuery; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Optional. New incoming pre-checkout query. Contains full information about checkout |
127
|
|
|
* |
128
|
|
|
* @var PreCheckoutQuery |
129
|
|
|
*/ |
130
|
|
|
protected $preCheckoutQuery; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return int |
134
|
|
|
*/ |
135
|
|
|
public function getUpdateId() |
136
|
|
|
{ |
137
|
|
|
return $this->updateId; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param int $updateId |
142
|
|
|
*/ |
143
|
3 |
|
public function setUpdateId($updateId) |
144
|
|
|
{ |
145
|
3 |
|
$this->updateId = $updateId; |
146
|
3 |
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return Message |
150
|
|
|
*/ |
151
|
9 |
|
public function getMessage() |
152
|
|
|
{ |
153
|
9 |
|
return $this->message; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param Message $message |
158
|
|
|
*/ |
159
|
3 |
|
public function setMessage(Message $message) |
160
|
|
|
{ |
161
|
3 |
|
$this->message = $message; |
162
|
3 |
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return Message |
166
|
|
|
*/ |
167
|
|
|
public function getEditedMessage() |
168
|
|
|
{ |
169
|
|
|
return $this->editedMessage; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param Message $editedMessage |
174
|
|
|
*/ |
175
|
|
|
public function setEditedMessage($editedMessage) |
176
|
|
|
{ |
177
|
|
|
$this->editedMessage = $editedMessage; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @return Message |
182
|
|
|
*/ |
183
|
|
|
public function getChannelPost() |
184
|
|
|
{ |
185
|
|
|
return $this->channelPost; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @param Message $channelPost |
190
|
|
|
*/ |
191
|
|
|
public function setChannelPost($channelPost) |
192
|
|
|
{ |
193
|
|
|
$this->channelPost = $channelPost; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @return PollAnswer |
198
|
|
|
*/ |
199
|
|
|
public function getPollAnswer() |
200
|
|
|
{ |
201
|
|
|
return $this->pollAnswer; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @return Poll |
206
|
|
|
*/ |
207
|
|
|
public function getPoll() |
208
|
|
|
{ |
209
|
|
|
return $this->poll; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @param Poll $poll |
214
|
|
|
*/ |
215
|
|
|
public function setPoll($poll) |
216
|
|
|
{ |
217
|
|
|
$this->poll = $poll; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @param PollAnswer $pollAnswer |
222
|
|
|
*/ |
223
|
|
|
public function setPollAnswer($pollAnswer) |
224
|
|
|
{ |
225
|
|
|
$this->pollAnswer = $pollAnswer; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @return Message |
230
|
|
|
*/ |
231
|
|
|
public function getEditedChannelPost() |
232
|
|
|
{ |
233
|
|
|
return $this->editedChannelPost; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* @param Message $editedChannelPost |
238
|
|
|
*/ |
239
|
|
|
public function setEditedChannelPost($editedChannelPost) |
240
|
|
|
{ |
241
|
|
|
$this->editedChannelPost = $editedChannelPost; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @return InlineQuery |
246
|
|
|
*/ |
247
|
8 |
|
public function getInlineQuery() |
248
|
|
|
{ |
249
|
8 |
|
return $this->inlineQuery; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @param InlineQuery $inlineQuery |
254
|
|
|
*/ |
255
|
1 |
|
public function setInlineQuery($inlineQuery) |
256
|
|
|
{ |
257
|
1 |
|
$this->inlineQuery = $inlineQuery; |
258
|
1 |
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @return ChosenInlineResult |
262
|
|
|
*/ |
263
|
|
|
public function getChosenInlineResult() |
264
|
|
|
{ |
265
|
|
|
return $this->chosenInlineResult; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @param ChosenInlineResult $chosenInlineResult |
270
|
|
|
*/ |
271
|
|
|
public function setChosenInlineResult($chosenInlineResult) |
272
|
|
|
{ |
273
|
|
|
$this->chosenInlineResult = $chosenInlineResult; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @return CallbackQuery |
278
|
|
|
*/ |
279
|
|
|
public function getCallbackQuery() |
280
|
|
|
{ |
281
|
|
|
return $this->callbackQuery; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @param CallbackQuery $callbackQuery |
286
|
|
|
*/ |
287
|
|
|
public function setCallbackQuery($callbackQuery) |
288
|
|
|
{ |
289
|
|
|
$this->callbackQuery = $callbackQuery; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* @author MY |
294
|
|
|
* @return ShippingQuery |
295
|
|
|
*/ |
296
|
|
|
public function getShippingQuery() |
297
|
|
|
{ |
298
|
|
|
return $this->shippingQuery; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @author MY |
303
|
|
|
* @param ShippingQuery $shippingQuery |
304
|
|
|
*/ |
305
|
|
|
public function setShippingQuery($shippingQuery) |
306
|
|
|
{ |
307
|
|
|
$this->shippingQuery = $shippingQuery; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @author MY |
312
|
|
|
* @return PreCheckoutQuery |
313
|
|
|
*/ |
314
|
|
|
public function getPreCheckoutQuery() |
315
|
|
|
{ |
316
|
|
|
return $this->preCheckoutQuery; |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* @author MY |
321
|
|
|
* @param PreCheckoutQuery $preCheckoutQuery |
322
|
|
|
*/ |
323
|
|
|
public function setPreCheckoutQuery($preCheckoutQuery) |
324
|
|
|
{ |
325
|
|
|
$this->preCheckoutQuery = $preCheckoutQuery; |
326
|
|
|
} |
327
|
|
|
} |
328
|
|
|
|