From fb1a844526eb653eaff6cd2b8eaf89c4269035bc Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 10 Apr 2023 20:58:16 -0400 Subject: [PATCH] Added method `\TgBotLib\Bot > setStickerMaskPosition()` to change the mask position of a mask sticker. See [setStickerMaskPosition](https://core.telegram.org/bots/api#setstickermaskposition) for more information. https://git.n64.cc/nosial/libs/tgbot/-/issues/2 --- CHANGELOG.md | 2 ++ src/TgBotLib/Bot.php | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4caa237..3f1a1cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ This update accompanies the release of the [Telegram Bot API 6.6](https://core.t See [setStickerEmojiList](https://core.telegram.org/bots/api#setstickeremojilist) for more information. * Added method `\TgBotLib\Bot > setStickerKeywords()` to set the list of emojis for a sticker set. See [setStickerKeywords](https://core.telegram.org/bots/api#setstickerkeywords) for more information. + * Added method `\TgBotLib\Bot > setStickerMaskPosition()` to change the mask position of a mask sticker. + See [setStickerMaskPosition](https://core.telegram.org/bots/api#setstickermaskposition) for more information. ### Changed * Removed unused `__destruct()` method from `\TgBotLib\Bot` diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index 8317340..4b30aa1 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -2712,4 +2712,27 @@ return true; } + + /** + * Use this method to change the mask position of a mask sticker. + * The sticker must belong to a sticker set that was created by the bot. Returns True on success. + * + * @param string $sticker File identifier of the sticker + * @param array $mask_position A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. + * @param array $options Optional parameters + * @return bool + * @throws TelegramException + * @link https://core.telegram.org/bots/api#setstickermaskposition + * @noinspection PhpUnused + * @see https://core.telegram.org/bots/api#maskposition + */ + public function setStickerMaskPosition(string $sticker, array $mask_position, array $options=[]): bool + { + $this->sendRequest('setStickerMaskPosition', array_merge([ + 'sticker' => $sticker, + 'mask_position' => $mask_position + ], $options)); + + return true; + } } \ No newline at end of file