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