|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Greenplugin\TelegramBot\Type\InlineQueryResult; |
|
6
|
|
|
|
|
7
|
|
|
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface; |
|
8
|
|
|
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait; |
|
9
|
|
|
use Greenplugin\TelegramBot\Type\InputMessageContent\InputMessageContentType; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class InlineQueryResultVideoType |
|
13
|
|
|
* Represents a link to a page containing an embedded video player or a video file. |
|
14
|
|
|
* By default, this video file will be sent by the user with an optional caption. |
|
15
|
|
|
* Alternatively, you can use input_message_content to send a message with the specified content instead of the video. |
|
16
|
|
|
* |
|
17
|
|
|
* If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), |
|
18
|
|
|
* you must replace its content using inputMessageContent. |
|
19
|
|
|
* |
|
20
|
|
|
* @see https://core.telegram.org/bots/api#inlinequeryresultvideo |
|
21
|
|
|
*/ |
|
22
|
|
|
class InlineQueryResultVideoType extends InlineQueryResultType implements HasParseModeVariableInterface |
|
23
|
|
|
{ |
|
24
|
|
|
use FillFromArrayTrait; |
|
25
|
|
|
const MIME_TYPE_TEXT = 'text/html'; |
|
26
|
|
|
const MIME_TYPE_VIDEO = 'video/mp4'; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* A valid URL for the embedded video player or video file. |
|
30
|
|
|
* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
public $video; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Mime type of the content of video url, “text/html” or “video/mp4”. |
|
37
|
|
|
* |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
public $mimeType; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* URL of the thumbnail (jpeg only) for the video;. |
|
44
|
|
|
* |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
public $thumbUrl; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Title for the result. |
|
51
|
|
|
* |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
public $title; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Optional. Caption of the video to be sent, 0-1024 characters. |
|
58
|
|
|
* |
|
59
|
|
|
* @var string|null |
|
60
|
|
|
*/ |
|
61
|
|
|
public $caption; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, |
|
65
|
|
|
* fixed-width text or inline URLs in the media caption. |
|
66
|
|
|
* |
|
67
|
|
|
* @var string|null |
|
68
|
|
|
*/ |
|
69
|
|
|
public $parseMode; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Optional. Video width. |
|
73
|
|
|
* |
|
74
|
|
|
* @var int|null |
|
75
|
|
|
*/ |
|
76
|
|
|
public $videoWidth; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Optional. Video height. |
|
80
|
|
|
* |
|
81
|
|
|
* @var int|null |
|
82
|
|
|
*/ |
|
83
|
|
|
public $videoHeight; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Optional. Video duration in seconds. |
|
87
|
|
|
* |
|
88
|
|
|
* @var int|null |
|
89
|
|
|
*/ |
|
90
|
|
|
public $videoDuration; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Optional. Short description of the result. |
|
94
|
|
|
* |
|
95
|
|
|
* @var string|null |
|
96
|
|
|
*/ |
|
97
|
|
|
public $description; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Optional. Content of the message to be sent instead of the video. |
|
101
|
|
|
* This field is required if InlineQueryResultVideo is used to send an HTML-page as a result |
|
102
|
|
|
* (e.g., a YouTube video). |
|
103
|
|
|
* |
|
104
|
|
|
* @var InputMessageContentType|null |
|
105
|
|
|
*/ |
|
106
|
|
|
public $inputMessageContent; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @param string $id |
|
110
|
|
|
* @param string $video |
|
111
|
|
|
* @param string $mimeType |
|
112
|
|
|
* @param string $thumbUrl |
|
113
|
|
|
* @param string $title |
|
114
|
|
|
* @param array|null $data |
|
115
|
|
|
* |
|
116
|
|
|
* @throws \Greenplugin\TelegramBot\Exception\BadArgumentException |
|
117
|
|
|
* |
|
118
|
|
|
* @return InlineQueryResultVideoType |
|
119
|
|
|
*/ |
|
120
|
|
|
public static function create( |
|
121
|
|
|
string $id, |
|
122
|
|
|
string $video, |
|
123
|
|
|
string $mimeType, |
|
124
|
|
|
string $thumbUrl, |
|
125
|
|
|
string $title, |
|
126
|
|
|
array $data = null |
|
127
|
|
|
): InlineQueryResultVideoType { |
|
128
|
|
|
$instance = new static(); |
|
129
|
|
|
$instance->type = static::TYPE_VIDEO; |
|
130
|
|
|
$instance->id = $id; |
|
131
|
|
|
$instance->video = $video; |
|
132
|
|
|
$instance->mimeType = $mimeType; |
|
133
|
|
|
$instance->thumbUrl = $thumbUrl; |
|
134
|
|
|
$instance->title = $title; |
|
135
|
|
|
if ($data) { |
|
136
|
|
|
$instance->fill($data); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
return $instance; |
|
140
|
|
|
} |
|
141
|
|
|
} |
|
142
|
|
|
|