1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Method; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Method\Traits\EmojisVariableTrait; |
8
|
|
|
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait; |
9
|
|
|
use TgBotApi\BotApiBase\Type\InputFileType; |
10
|
|
|
use TgBotApi\BotApiBase\Type\MaskPositionType; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class AddStickerToSetMethod. |
14
|
|
|
* |
15
|
|
|
* @see https://core.telegram.org/bots/api#addstickertoset |
16
|
|
|
*/ |
17
|
|
|
class AddStickerToSetMethod |
18
|
|
|
{ |
19
|
|
|
use FillFromArrayTrait; |
20
|
|
|
use EmojisVariableTrait; |
21
|
|
|
/** |
22
|
|
|
* User identifier of sticker set owner. |
23
|
|
|
* |
24
|
|
|
* @var int |
25
|
|
|
*/ |
26
|
|
|
public $userId; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Sticker set name. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
public $name; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Png image with the sticker, must be up to 512 kilobytes in size, |
37
|
|
|
* dimensions must not exceed 512px, and either width or height must be exactly 512px. |
38
|
|
|
* Pass a file_id as a String to send a file that already exists on the Telegram servers, |
39
|
|
|
* pass an HTTP URL as a String for Telegram to get a file from the Internet, |
40
|
|
|
* or upload a new one using multipart/form-data. |
41
|
|
|
* |
42
|
|
|
* @var InputFileType|string |
43
|
|
|
*/ |
44
|
|
|
public $pngSticker; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Optional. A JSON-serialized object for position where the mask should be placed on faces. |
48
|
|
|
* |
49
|
|
|
* @var MaskPositionType|null |
50
|
|
|
*/ |
51
|
|
|
public $maskPosition; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param int $userId |
55
|
|
|
* @param string $name |
56
|
|
|
* @param InputFileType|string $pngSticker |
57
|
|
|
* @param string $emojis |
58
|
|
|
* @param array|null $data |
59
|
|
|
* |
60
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
61
|
|
|
* |
62
|
|
|
* @return AddStickerToSetMethod |
63
|
|
|
*/ |
64
|
3 |
|
public static function create( |
65
|
|
|
int $userId, |
66
|
|
|
string $name, |
67
|
|
|
$pngSticker, |
68
|
|
|
string $emojis, |
69
|
|
|
array $data = null |
70
|
|
|
): AddStickerToSetMethod { |
71
|
3 |
|
$instance = new static(); |
72
|
3 |
|
$instance->userId = $userId; |
73
|
3 |
|
$instance->name = $name; |
74
|
3 |
|
$instance->pngSticker = $pngSticker; |
75
|
3 |
|
$instance->emojis = $emojis; |
76
|
3 |
|
if ($data) { |
77
|
3 |
|
$instance->fill($data); |
78
|
|
|
} |
79
|
|
|
|
80
|
3 |
|
return $instance; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|