1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace unreal4u\TelegramAPI\Telegram\Methods; |
6
|
|
|
|
7
|
|
|
use Generator; |
8
|
|
|
use Psr\Log\LoggerInterface; |
9
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramMethods; |
10
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramTypes; |
11
|
|
|
use unreal4u\TelegramAPI\InternalFunctionality\TelegramResponse; |
12
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile; |
13
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean; |
14
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\MaskPosition; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. |
18
|
|
|
* Returns True on success |
19
|
|
|
* |
20
|
|
|
* Objects defined as-is july 2017 |
21
|
|
|
* |
22
|
|
|
* @see https://core.telegram.org/bots/api#createnewstickerset |
23
|
|
|
*/ |
24
|
|
|
class CreateNewStickerSet extends TelegramMethods |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* User identifier of created sticker set owner |
28
|
|
|
* @var int |
29
|
|
|
*/ |
30
|
|
|
public $user_id = 0; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english |
34
|
|
|
* letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in |
35
|
|
|
* "_by_<bot username>". <bot_username> is case insensitive. 1-64 characters |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
public $name = ''; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Sticker set title, 1-64 characters |
42
|
|
|
* @var bool |
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, and either |
48
|
|
|
* width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the |
49
|
|
|
* Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one |
50
|
|
|
* using multipart/form-data |
51
|
|
|
* @var string|InputFile |
52
|
|
|
*/ |
53
|
|
|
public $png_sticker; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* One or more emoji corresponding to the sticker |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
public $emojis = ''; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Pass True, if a set of mask stickers should be created |
63
|
|
|
* @var bool |
64
|
|
|
*/ |
65
|
|
|
public $is_masks = false; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Position where the mask should be placed on faces |
69
|
|
|
* @var MaskPosition |
70
|
|
|
*/ |
71
|
|
|
public $mask_position; |
72
|
|
|
|
73
|
|
|
public static function bindToObject(TelegramResponse $data, LoggerInterface $logger): TelegramTypes |
74
|
|
|
{ |
75
|
|
|
return new ResultBoolean($data->getResultBoolean(), $logger); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getMandatoryFields(): array |
79
|
|
|
{ |
80
|
|
|
return [ |
81
|
|
|
'user_id', |
82
|
|
|
'name', |
83
|
|
|
'title', |
84
|
|
|
'png_sticker', |
85
|
|
|
'emojis', |
86
|
|
|
]; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function hasLocalFiles(): bool |
90
|
|
|
{ |
91
|
|
|
return $this->png_sticker instanceof InputFile; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getLocalFiles(): Generator |
95
|
|
|
{ |
96
|
|
|
yield 'png_sticker' => $this->png_sticker; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|