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