11<?php
22
3- declare (strict_types = 1 );
3+ declare (strict_types= 1 );
44
55namespace unreal4u \TelegramAPI \Telegram \Methods ;
66
1717 * Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set.
1818 * Returns True on success
1919 *
20- * Objects defined as-is july 2017
20+ * Objects defined as-is June 2020, Bot API v4.9
2121 *
2222 * @see https://core.telegram.org/bots/api#createnewstickerset
2323 */
@@ -52,20 +52,28 @@ class CreateNewStickerSet extends TelegramMethods
5252 */
5353 public $ png_sticker ;
5454
55+ /**
56+ * TGS animation with the sticker, uploaded using multipart/form-data.
57+ *
58+ * @see https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
59+ * @var InputFile
60+ */
61+ public $ tgs_sticker ;
62+
5563 /**
5664 * One or more emoji corresponding to the sticker
5765 * @var string
5866 */
5967 public $ emojis = '' ;
6068
6169 /**
62- * Pass True, if a set of mask stickers should be created
70+ * Optional. Pass True, if a set of mask stickers should be created
6371 * @var bool
6472 */
65- public $ is_masks = false ;
73+ public $ is_masks ;
6674
6775 /**
68- * Position where the mask should be placed on faces
76+ * Optional. Position where the mask should be placed on faces
6977 * @var MaskPosition
7078 */
7179 public $ mask_position ;
@@ -77,22 +85,30 @@ public static function bindToObject(TelegramResponse $data, LoggerInterface $log
7785
7886 public function getMandatoryFields (): array
7987 {
80- return [
88+ $ return = [
8189 'user_id ' ,
8290 'name ' ,
8391 'title ' ,
84- 'png_sticker ' ,
8592 'emojis ' ,
8693 ];
94+
95+ // Define property as mandatory when not filled in
96+ if (empty ($ this ->png_sticker ) && empty ($ this ->tgs_sticker )) {
97+ $ return [] = 'png_sticker ' ;
98+ $ return [] = 'tgs_sticker ' ;
99+ }
100+
101+ return $ return ;
87102 }
88103
89104 public function hasLocalFiles (): bool
90105 {
91- return $ this ->png_sticker instanceof InputFile;
106+ return $ this ->png_sticker instanceof InputFile || $ this -> tgs_sticker instanceof InputFile ;
92107 }
93108
94109 public function getLocalFiles (): Generator
95110 {
96111 yield 'png_sticker ' => $ this ->png_sticker ;
112+ yield 'tgs_sticker ' => $ this ->tgs_sticker ;
97113 }
98114}
0 commit comments