From c7196005ac092722148c1b80f85ccddff7b50501 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 15 Nov 2024 15:05:48 -0500 Subject: [PATCH] Add SetStickerMaskPosition method --- src/TgBotLib/Enums/Methods.php | 3 ++ .../Methods/SetStickerMaskPosition.php | 53 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/TgBotLib/Methods/SetStickerMaskPosition.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 4090603..d3a580f 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -101,6 +101,7 @@ use TgBotLib\Methods\SetMyName; use TgBotLib\Methods\SetMyShortDescription; use TgBotLib\Methods\SetStickerEmojiList; + use TgBotLib\Methods\SetStickerMaskPosition; use TgBotLib\Methods\SetStickerPositionInSet; use TgBotLib\Methods\SetWebhook; use TgBotLib\Methods\StopMessageLiveLocation; @@ -224,6 +225,7 @@ case DELETE_STICKER_FROM_SET = 'deleteStickerFromSet'; case REPLACE_STICKER_IN_SET = 'replaceStickerInSet'; case SET_STICKER_EMOJI_LIST = 'setStickerEmojiList'; + case SET_STICKER_MASK_POSITION = 'setStickerMaskPosition'; /** * Executes a command on the provided bot with the given parameters. @@ -345,6 +347,7 @@ self::DELETE_STICKER_FROM_SET => DeleteStickerFromSet::execute($bot, $parameters), self::REPLACE_STICKER_IN_SET => ReplaceStickerInSet::execute($bot, $parameters), self::SET_STICKER_EMOJI_LIST => SetStickerEmojiList::execute($bot, $parameters), + self::SET_STICKER_MASK_POSITION => SetStickerMaskPosition::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/SetStickerMaskPosition.php b/src/TgBotLib/Methods/SetStickerMaskPosition.php new file mode 100644 index 0000000..7b3d52b --- /dev/null +++ b/src/TgBotLib/Methods/SetStickerMaskPosition.php @@ -0,0 +1,53 @@ +toArray()); + } + + if(is_array($parameters['mask_position'])) + { + $parameters['mask_position'] = json_encode($parameters['mask_position']); + } + } + + return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_STICKER_MASK_POSITION->value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'sticker' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'mask_position' + ]; + } + } \ No newline at end of file