1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
6
|
|
|
use TelegramBot\Api\Types\Inline\InputMessageContent; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class InlineQueryResultMpeg4Gif |
10
|
|
|
* Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). |
11
|
|
|
* By default, this animated MPEG-4 file will be sent by the user with optional caption. |
12
|
|
|
* Alternatively, you can provide message_text to send it instead of the animation. |
13
|
|
|
* |
14
|
|
|
* @package TelegramBot\Api\Types\Inline |
15
|
|
|
*/ |
16
|
|
|
class Mpeg4Gif extends AbstractInlineQueryResult |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* {@inheritdoc} |
20
|
|
|
* |
21
|
|
|
* @var array |
22
|
|
|
*/ |
23
|
|
|
protected static $requiredParams = ['type', 'id', 'mpeg4_url', 'thumbnail_url']; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
* |
28
|
|
|
* @var array |
29
|
|
|
*/ |
30
|
|
|
protected static $map = [ |
31
|
|
|
'type' => true, |
32
|
|
|
'id' => true, |
33
|
|
|
'mpeg4_url' => true, |
34
|
|
|
'mpeg4_width' => true, |
35
|
|
|
'mpeg4_height' => true, |
36
|
|
|
'thumbnail_url' => true, |
37
|
|
|
'title' => true, |
38
|
|
|
'caption' => true, |
39
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
40
|
|
|
'input_message_content' => InputMessageContent::class, |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
* |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $type = 'mpeg4_gif'; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* A valid URL for the MP4 file. File size must not exceed 1MB |
52
|
|
|
* |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $mpeg4Url; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. Video width |
59
|
|
|
* |
60
|
|
|
* @var int|null |
61
|
|
|
*/ |
62
|
|
|
protected $mpeg4Width; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Optional. Video height |
66
|
|
|
* |
67
|
|
|
* @var int|null |
68
|
|
|
*/ |
69
|
|
|
protected $mpeg4Height; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* URL of the static thumbnail (jpeg or gif) for the result |
73
|
|
|
* |
74
|
|
|
* @var string |
75
|
|
|
*/ |
76
|
|
|
protected $thumbnailUrl; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Optional. Caption of the MPEG-4 file to be sent, 0-200 characters |
80
|
|
|
* |
81
|
|
|
* @var string|null |
82
|
|
|
*/ |
83
|
|
|
protected $caption; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* InlineQueryResultMpeg4Gif constructor. |
87
|
|
|
* |
88
|
|
|
* @param string $id |
89
|
|
|
* @param string $mpeg4Url |
90
|
|
|
* @param string $thumbnailUrl |
91
|
|
|
* @param int|null $mpeg4Width |
92
|
|
|
* @param int|null $mpeg4Height |
93
|
|
|
* @param string|null $caption |
94
|
|
|
* @param string|null $title |
95
|
|
|
* @param InputMessageContent $inputMessageContent |
96
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
97
|
|
|
*/ |
98
|
|
|
public function __construct( |
99
|
|
|
$id, |
100
|
|
|
$mpeg4Url, |
101
|
|
|
$thumbnailUrl, |
102
|
|
|
$title = null, |
103
|
|
|
$caption = null, |
104
|
|
|
$mpeg4Width = null, |
105
|
|
|
$mpeg4Height = null, |
106
|
|
|
$inputMessageContent = null, |
107
|
|
|
$inlineKeyboardMarkup = null |
108
|
|
|
) { |
109
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
110
|
|
|
|
111
|
|
|
$this->mpeg4Url = $mpeg4Url; |
112
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
113
|
|
|
$this->mpeg4Width = $mpeg4Width; |
114
|
|
|
$this->mpeg4Height = $mpeg4Height; |
115
|
|
|
$this->caption = $caption; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
|
|
public function getMpeg4Url() |
122
|
|
|
{ |
123
|
|
|
return $this->mpeg4Url; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $mpeg4Url |
128
|
|
|
* |
129
|
|
|
* @return void |
130
|
|
|
*/ |
131
|
|
|
public function setMpeg4Url($mpeg4Url) |
132
|
|
|
{ |
133
|
|
|
$this->mpeg4Url = $mpeg4Url; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return int|null |
138
|
|
|
*/ |
139
|
|
|
public function getMpeg4Width() |
140
|
|
|
{ |
141
|
|
|
return $this->mpeg4Width; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param int|null $mpeg4Width |
146
|
|
|
* |
147
|
|
|
* @return void |
148
|
|
|
*/ |
149
|
|
|
public function setMpeg4Width($mpeg4Width) |
150
|
|
|
{ |
151
|
|
|
$this->mpeg4Width = $mpeg4Width; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return int|null |
156
|
|
|
*/ |
157
|
|
|
public function getMpeg4Height() |
158
|
|
|
{ |
159
|
|
|
return $this->mpeg4Height; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param int|null $mpeg4Height |
164
|
|
|
* |
165
|
|
|
* @return void |
166
|
|
|
*/ |
167
|
|
|
public function setMpeg4Height($mpeg4Height) |
168
|
|
|
{ |
169
|
|
|
$this->mpeg4Height = $mpeg4Height; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
|
|
public function getThumbnailUrl() |
176
|
|
|
{ |
177
|
|
|
return $this->thumbnailUrl; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param string $thumbnailUrl |
182
|
|
|
* |
183
|
|
|
* @return void |
184
|
|
|
*/ |
185
|
|
|
public function setThumbnailUrl($thumbnailUrl) |
186
|
|
|
{ |
187
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @deprecated Use getThumbnailUrl |
192
|
|
|
* |
193
|
|
|
* @return string |
194
|
|
|
*/ |
195
|
|
|
public function getThumbUrl() |
196
|
|
|
{ |
197
|
|
|
return $this->getThumbnailUrl(); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @deprecated Use setThumbnailUrl |
202
|
|
|
* |
203
|
|
|
* @param string $thumbUrl |
204
|
|
|
* |
205
|
|
|
* @return void |
206
|
|
|
*/ |
207
|
|
|
public function setThumbUrl($thumbUrl) |
208
|
|
|
{ |
209
|
|
|
$this->setThumbnailUrl($thumbUrl); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return string|null |
214
|
|
|
*/ |
215
|
|
|
public function getCaption() |
216
|
|
|
{ |
217
|
|
|
return $this->caption; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @param string|null $caption |
222
|
|
|
* |
223
|
|
|
* @return void |
224
|
|
|
*/ |
225
|
|
|
public function setCaption($caption) |
226
|
|
|
{ |
227
|
|
|
$this->caption = $caption; |
228
|
|
|
} |
229
|
|
|
} |
230
|
|
|
|