|
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
|
|
|
protected static $requiredParams = ['update_id']; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritdoc} |
|
30
|
|
|
* |
|
31
|
|
|
* @var array |
|
32
|
|
|
*/ |
|
33
|
|
|
protected static $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
|
|
|
'my_chat_member' => ChatMemberUpdated::class, |
|
47
|
|
|
'chat_member' => ChatMemberUpdated::class, |
|
48
|
|
|
'chat_join_request' => ChatJoinRequest::class, |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* The update‘s unique identifier. |
|
53
|
|
|
* Update identifiers start from a certain positive number and increase sequentially. |
|
54
|
|
|
* This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or |
|
55
|
|
|
* to restore the correct update sequence, should they get out of order. |
|
56
|
|
|
* |
|
57
|
|
|
* @var integer |
|
58
|
|
|
*/ |
|
59
|
|
|
protected $updateId; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Optional. New incoming message of any kind — text, photo, sticker, etc. |
|
63
|
|
|
* |
|
64
|
|
|
* @var Message|null |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $message; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. |
|
70
|
|
|
* |
|
71
|
|
|
* @var PollAnswer|null |
|
72
|
|
|
*/ |
|
73
|
|
|
protected $pollAnswer; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot |
|
77
|
|
|
* |
|
78
|
|
|
* @var Poll|null |
|
79
|
|
|
*/ |
|
80
|
|
|
protected $poll; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Optional. New version of a message that is known to the bot and was edited |
|
84
|
|
|
* |
|
85
|
|
|
* @var Message|null |
|
86
|
|
|
*/ |
|
87
|
|
|
protected $editedMessage; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Optional. New incoming channel post of any kind — text, photo, sticker, etc. |
|
91
|
|
|
* |
|
92
|
|
|
* @var Message|null |
|
93
|
|
|
*/ |
|
94
|
|
|
protected $channelPost; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Optional. New version of a channel post that is known to the bot and was edited |
|
98
|
|
|
* |
|
99
|
|
|
* @var Message|null |
|
100
|
|
|
*/ |
|
101
|
|
|
protected $editedChannelPost; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Optional. New incoming inline query |
|
105
|
|
|
* |
|
106
|
|
|
* @var \TelegramBot\Api\Types\Inline\InlineQuery|null |
|
107
|
|
|
*/ |
|
108
|
|
|
protected $inlineQuery; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Optional. The result of a inline query that was chosen by a user and sent to their chat partner |
|
112
|
|
|
* |
|
113
|
|
|
* @var \TelegramBot\Api\Types\Inline\ChosenInlineResult|null |
|
114
|
|
|
*/ |
|
115
|
|
|
protected $chosenInlineResult; |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Optional. New incoming callback query |
|
119
|
|
|
* |
|
120
|
|
|
* @var \TelegramBot\Api\Types\CallbackQuery|null |
|
121
|
|
|
*/ |
|
122
|
|
|
protected $callbackQuery; |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Optional. New incoming shipping query. Only for invoices with flexible price |
|
126
|
|
|
* |
|
127
|
|
|
* @var ShippingQuery|null |
|
128
|
|
|
*/ |
|
129
|
|
|
protected $shippingQuery; |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* Optional. New incoming pre-checkout query. Contains full information about checkout |
|
133
|
|
|
* |
|
134
|
|
|
* @var PreCheckoutQuery|null |
|
135
|
|
|
*/ |
|
136
|
|
|
protected $preCheckoutQuery; |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only |
|
140
|
|
|
* when the bot is blocked or unblocked by the user. |
|
141
|
|
|
* |
|
142
|
|
|
* @var ChatMemberUpdated|null |
|
143
|
3 |
|
*/ |
|
144
|
|
|
protected $myChatMember; |
|
145
|
3 |
|
|
|
146
|
3 |
|
/** |
|
147
|
|
|
* Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must |
|
148
|
|
|
* explicitly specify “chat_member” in the list of allowed_updates to receive these updates. |
|
149
|
|
|
* |
|
150
|
|
|
* @var ChatMemberUpdated|null |
|
151
|
9 |
|
*/ |
|
152
|
|
|
protected $chatMember; |
|
153
|
9 |
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator |
|
156
|
|
|
* right in the chat to receive these updates. |
|
157
|
|
|
* |
|
158
|
|
|
* @var ChatJoinRequest|null |
|
159
|
3 |
|
*/ |
|
160
|
|
|
protected $chatJoinRequest; |
|
161
|
3 |
|
|
|
162
|
3 |
|
/** |
|
163
|
|
|
* @return int |
|
164
|
|
|
*/ |
|
165
|
|
|
public function getUpdateId() |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->updateId; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @param int $updateId |
|
172
|
|
|
* |
|
173
|
|
|
* @return void |
|
174
|
|
|
*/ |
|
175
|
|
|
public function setUpdateId($updateId) |
|
176
|
|
|
{ |
|
177
|
|
|
$this->updateId = $updateId; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @return Message|null |
|
182
|
|
|
*/ |
|
183
|
|
|
public function getMessage() |
|
184
|
|
|
{ |
|
185
|
|
|
return $this->message; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @param Message $message |
|
190
|
|
|
* |
|
191
|
|
|
* @return void |
|
192
|
|
|
*/ |
|
193
|
|
|
public function setMessage(Message $message) |
|
194
|
|
|
{ |
|
195
|
|
|
$this->message = $message; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @return Message|null |
|
200
|
|
|
*/ |
|
201
|
|
|
public function getEditedMessage() |
|
202
|
|
|
{ |
|
203
|
|
|
return $this->editedMessage; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* @param Message $editedMessage |
|
208
|
|
|
* |
|
209
|
|
|
* @return void |
|
210
|
|
|
*/ |
|
211
|
|
|
public function setEditedMessage($editedMessage) |
|
212
|
|
|
{ |
|
213
|
|
|
$this->editedMessage = $editedMessage; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
/** |
|
217
|
|
|
* @return Message|null |
|
218
|
|
|
*/ |
|
219
|
|
|
public function getChannelPost() |
|
220
|
|
|
{ |
|
221
|
|
|
return $this->channelPost; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* @param Message $channelPost |
|
226
|
|
|
* |
|
227
|
|
|
* @return void |
|
228
|
|
|
*/ |
|
229
|
|
|
public function setChannelPost($channelPost) |
|
230
|
|
|
{ |
|
231
|
|
|
$this->channelPost = $channelPost; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @return PollAnswer|null |
|
236
|
|
|
*/ |
|
237
|
|
|
public function getPollAnswer() |
|
238
|
|
|
{ |
|
239
|
|
|
return $this->pollAnswer; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
/** |
|
243
|
|
|
* @return Poll|null |
|
244
|
|
|
*/ |
|
245
|
|
|
public function getPoll() |
|
246
|
|
|
{ |
|
247
|
8 |
|
return $this->poll; |
|
248
|
|
|
} |
|
249
|
8 |
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @param Poll $poll |
|
252
|
|
|
* |
|
253
|
|
|
* @return void |
|
254
|
|
|
*/ |
|
255
|
1 |
|
public function setPoll($poll) |
|
256
|
|
|
{ |
|
257
|
1 |
|
$this->poll = $poll; |
|
258
|
1 |
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* @param PollAnswer $pollAnswer |
|
262
|
|
|
* |
|
263
|
|
|
* @return void |
|
264
|
|
|
*/ |
|
265
|
|
|
public function setPollAnswer($pollAnswer) |
|
266
|
|
|
{ |
|
267
|
|
|
$this->pollAnswer = $pollAnswer; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* @return Message|null |
|
272
|
|
|
*/ |
|
273
|
|
|
public function getEditedChannelPost() |
|
274
|
|
|
{ |
|
275
|
|
|
return $this->editedChannelPost; |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** |
|
279
|
|
|
* @param Message $editedChannelPost |
|
280
|
|
|
* |
|
281
|
|
|
* @return void |
|
282
|
|
|
*/ |
|
283
|
|
|
public function setEditedChannelPost($editedChannelPost) |
|
284
|
|
|
{ |
|
285
|
|
|
$this->editedChannelPost = $editedChannelPost; |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
/** |
|
289
|
|
|
* @return InlineQuery|null |
|
290
|
|
|
*/ |
|
291
|
|
|
public function getInlineQuery() |
|
292
|
|
|
{ |
|
293
|
|
|
return $this->inlineQuery; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
/** |
|
297
|
|
|
* @param InlineQuery $inlineQuery |
|
298
|
|
|
* |
|
299
|
|
|
* @return void |
|
300
|
|
|
*/ |
|
301
|
|
|
public function setInlineQuery($inlineQuery) |
|
302
|
|
|
{ |
|
303
|
|
|
$this->inlineQuery = $inlineQuery; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
/** |
|
307
|
|
|
* @return ChosenInlineResult|null |
|
308
|
|
|
*/ |
|
309
|
|
|
public function getChosenInlineResult() |
|
310
|
|
|
{ |
|
311
|
|
|
return $this->chosenInlineResult; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* @param ChosenInlineResult $chosenInlineResult |
|
316
|
|
|
* |
|
317
|
|
|
* @return void |
|
318
|
|
|
*/ |
|
319
|
|
|
public function setChosenInlineResult($chosenInlineResult) |
|
320
|
|
|
{ |
|
321
|
|
|
$this->chosenInlineResult = $chosenInlineResult; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* @return CallbackQuery|null |
|
326
|
|
|
*/ |
|
327
|
|
|
public function getCallbackQuery() |
|
328
|
|
|
{ |
|
329
|
|
|
return $this->callbackQuery; |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
/** |
|
333
|
|
|
* @param CallbackQuery $callbackQuery |
|
334
|
|
|
* |
|
335
|
|
|
* @return void |
|
336
|
|
|
*/ |
|
337
|
|
|
public function setCallbackQuery($callbackQuery) |
|
338
|
|
|
{ |
|
339
|
|
|
$this->callbackQuery = $callbackQuery; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* @author MY |
|
344
|
|
|
* |
|
345
|
|
|
* @return ShippingQuery|null |
|
346
|
|
|
*/ |
|
347
|
|
|
public function getShippingQuery() |
|
348
|
|
|
{ |
|
349
|
|
|
return $this->shippingQuery; |
|
350
|
|
|
} |
|
351
|
|
|
|
|
352
|
|
|
/** |
|
353
|
|
|
* @author MY |
|
354
|
|
|
* |
|
355
|
|
|
* @param ShippingQuery $shippingQuery |
|
356
|
|
|
* |
|
357
|
|
|
* @return void |
|
358
|
|
|
*/ |
|
359
|
|
|
public function setShippingQuery($shippingQuery) |
|
360
|
|
|
{ |
|
361
|
|
|
$this->shippingQuery = $shippingQuery; |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
/** |
|
365
|
|
|
* @author MY |
|
366
|
|
|
* |
|
367
|
|
|
* @return PreCheckoutQuery|null |
|
368
|
|
|
*/ |
|
369
|
|
|
public function getPreCheckoutQuery() |
|
370
|
|
|
{ |
|
371
|
|
|
return $this->preCheckoutQuery; |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
/** |
|
375
|
|
|
* @author MY |
|
376
|
|
|
* |
|
377
|
|
|
* @param PreCheckoutQuery $preCheckoutQuery |
|
378
|
|
|
* |
|
379
|
|
|
* @return void |
|
380
|
|
|
*/ |
|
381
|
|
|
public function setPreCheckoutQuery($preCheckoutQuery) |
|
382
|
|
|
{ |
|
383
|
|
|
$this->preCheckoutQuery = $preCheckoutQuery; |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
/** |
|
387
|
|
|
* @return ChatMemberUpdated|null |
|
388
|
|
|
*/ |
|
389
|
|
|
public function getMyChatMember() |
|
390
|
|
|
{ |
|
391
|
|
|
return $this->myChatMember; |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
/** |
|
395
|
|
|
* @param ChatMemberUpdated|null $myChatMember |
|
396
|
|
|
* @return void |
|
397
|
|
|
*/ |
|
398
|
|
|
public function setMyChatMember($myChatMember) |
|
399
|
|
|
{ |
|
400
|
|
|
$this->myChatMember = $myChatMember; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
/** |
|
404
|
|
|
* @return ChatMemberUpdated|null |
|
405
|
|
|
*/ |
|
406
|
|
|
public function getChatMember() |
|
407
|
|
|
{ |
|
408
|
|
|
return $this->chatMember; |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* @param ChatMemberUpdated|null $chatMember |
|
413
|
|
|
* @return void |
|
414
|
|
|
*/ |
|
415
|
|
|
public function setChatMember($chatMember) |
|
416
|
|
|
{ |
|
417
|
|
|
$this->chatMember = $chatMember; |
|
418
|
|
|
} |
|
419
|
|
|
|
|
420
|
|
|
/** |
|
421
|
|
|
* @return ChatJoinRequest|null |
|
422
|
|
|
*/ |
|
423
|
|
|
public function getChatJoinRequest() |
|
424
|
|
|
{ |
|
425
|
|
|
return $this->chatJoinRequest; |
|
426
|
|
|
} |
|
427
|
|
|
|
|
428
|
|
|
/** |
|
429
|
|
|
* @param ChatJoinRequest|null $chatJoinRequest |
|
430
|
|
|
* @return void |
|
431
|
|
|
*/ |
|
432
|
|
|
public function setChatJoinRequest($chatJoinRequest) |
|
433
|
|
|
{ |
|
434
|
|
|
$this->chatJoinRequest = $chatJoinRequest; |
|
435
|
|
|
} |
|
436
|
|
|
} |
|
437
|
|
|
|