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 CreateNewStickerSetMethod. |
14
|
|
|
* |
15
|
|
|
* @see https://core.telegram.org/bots/api#createnewstickerset |
16
|
|
|
*/ |
17
|
|
|
class CreateNewStickerSetMethod |
18
|
|
|
{ |
19
|
|
|
use FillFromArrayTrait; |
20
|
|
|
use EmojisVariableTrait; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* User identifier of created sticker set owner. |
24
|
|
|
* |
25
|
|
|
* @var int |
26
|
|
|
*/ |
27
|
|
|
public $userId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). |
31
|
|
|
* Can contain only english letters, digits and underscores. |
32
|
|
|
* Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. |
33
|
|
|
* <bot_username> is case insensitive. 1-64 characters. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
public $name; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Sticker set title, 1-64 characters. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
public $title; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, |
48
|
|
|
* and either width or height must be exactly 512px. |
49
|
|
|
* Pass a file_id as a String to send a file that already exists on the Telegram servers, |
50
|
|
|
* pass an HTTP URL as a String for Telegram to get a file from the Internet, |
51
|
|
|
* or upload a new one using multipart/form-data. |
52
|
|
|
* |
53
|
|
|
* @var InputFileType|string |
54
|
|
|
*/ |
55
|
|
|
public $pngSticker; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. Pass True, if a set of mask stickers should be created. |
59
|
|
|
* |
60
|
|
|
* @var bool|null |
61
|
|
|
*/ |
62
|
|
|
public $containsMasks; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Optional. A JSON-serialized object for position where the mask should be placed on faces. |
66
|
|
|
* |
67
|
|
|
* @var MaskPositionType|null |
68
|
|
|
*/ |
69
|
|
|
public $maskPosition; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* CreateNewStickerSetMethod constructor. |
73
|
|
|
* |
74
|
|
|
* @param int $userId |
75
|
|
|
* @param string $name |
76
|
|
|
* @param string $title |
77
|
|
|
* @param InputFileType|string $pngSticker |
78
|
|
|
* @param string $emojis |
79
|
|
|
* @param array|null $data |
80
|
|
|
* |
81
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
82
|
|
|
* |
83
|
|
|
* @return CreateNewStickerSetMethod |
84
|
|
|
*/ |
85
|
|
|
public static function create( |
86
|
|
|
int $userId, |
87
|
|
|
string $name, |
88
|
|
|
string $title, |
89
|
|
|
$pngSticker, |
90
|
|
|
string $emojis, |
91
|
|
|
array $data = null |
92
|
|
|
): CreateNewStickerSetMethod { |
93
|
|
|
$instance = new static(); |
94
|
|
|
$instance->userId = $userId; |
95
|
|
|
$instance->$name = $name; |
96
|
|
|
$instance->title = $title; |
97
|
|
|
$instance->$pngSticker = $pngSticker; |
98
|
|
|
$instance->emojis = $emojis; |
99
|
|
|
if ($data) { |
100
|
|
|
$instance->fill($data); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return $instance; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|