|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Greenplugin\TelegramBot\Method; |
|
6
|
|
|
|
|
7
|
|
|
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface; |
|
8
|
|
|
use Greenplugin\TelegramBot\Method\Traits\CaptionVariablesTrait; |
|
9
|
|
|
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait; |
|
10
|
|
|
use Greenplugin\TelegramBot\Method\Traits\SendToChatVariablesTrait; |
|
11
|
|
|
use Greenplugin\TelegramBot\Type\InputFileType; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class SendVideoMethod. |
|
15
|
|
|
* |
|
16
|
|
|
* @see https://core.telegram.org/bots/api#sendvideo |
|
17
|
|
|
*/ |
|
18
|
|
|
class SendVideoMethod implements HasParseModeVariableInterface |
|
19
|
|
|
{ |
|
20
|
|
|
use FillFromArrayTrait; |
|
21
|
|
|
use SendToChatVariablesTrait; |
|
22
|
|
|
use CaptionVariablesTrait; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), |
|
26
|
|
|
* pass an HTTP URL as a String for Telegram to get a video from the Internet, |
|
27
|
|
|
* or upload a new video using multipart/form-data. |
|
28
|
|
|
* |
|
29
|
|
|
* @var InputFileType|string |
|
30
|
|
|
*/ |
|
31
|
|
|
public $video; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Optional. Duration of sent video in seconds. |
|
35
|
|
|
* |
|
36
|
|
|
* @var int|null |
|
37
|
|
|
*/ |
|
38
|
|
|
public $duration; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Optional. Video width. |
|
42
|
|
|
* |
|
43
|
|
|
* @var int|null |
|
44
|
|
|
*/ |
|
45
|
|
|
public $width; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Optional. Video height. |
|
49
|
|
|
* |
|
50
|
|
|
* @var int|null |
|
51
|
|
|
*/ |
|
52
|
|
|
public $height; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. |
|
56
|
|
|
* A thumbnail‘s width and height should not exceed 90. |
|
57
|
|
|
* Ignored if the file is not uploaded using multipart/form-data. |
|
58
|
|
|
* Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” |
|
59
|
|
|
* if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
60
|
|
|
* |
|
61
|
|
|
* @var InputFileType|string|null |
|
62
|
|
|
*/ |
|
63
|
|
|
public $thumb; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Optional. Pass True, if the uploaded video is suitable for streaming. |
|
67
|
|
|
* |
|
68
|
|
|
* @var bool|null |
|
69
|
|
|
*/ |
|
70
|
|
|
public $supportStreaming; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param int|string $chatId |
|
74
|
|
|
* @param InputFileType|string $video |
|
75
|
|
|
* @param array|null $data |
|
76
|
|
|
* |
|
77
|
|
|
* @throws \Greenplugin\TelegramBot\Exception\BadArgumentException |
|
78
|
|
|
* |
|
79
|
|
|
* @return SendVideoMethod |
|
80
|
|
|
*/ |
|
81
|
|
|
public static function create($chatId, $video, array $data = null): SendVideoMethod |
|
82
|
|
|
{ |
|
83
|
|
|
$instance = new static(); |
|
84
|
|
|
$instance->chatId = $chatId; |
|
85
|
|
|
$instance->video = $video; |
|
86
|
|
|
if ($data) { |
|
87
|
|
|
$instance->fill($data); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
return $instance; |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|