From 54fc17b54966e24f3d49860326a7bc39e6bc1f6a Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 10 Apr 2023 20:56:03 -0400 Subject: [PATCH] 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. https://git.n64.cc/nosial/libs/tgbot/-/issues/2 --- CHANGELOG.md | 2 ++ src/TgBotLib/Bot.php | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09795bf..4caa237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ This update accompanies the release of the [Telegram Bot API 6.6](https://core.t See [deleteStickerSet](https://core.telegram.org/bots/api#deletestickerset) for more information. * Added method `\TgBotLib\Bot > setStickerEmojiList()` to set the list of emojis for a sticker set. 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. ### Changed * Removed unused `__destruct()` method from `\TgBotLib\Bot` diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index 687ff55..8317340 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -2690,4 +2690,26 @@ return true; } + + /** + * Use this method to change search keywords assigned to a regular or custom emoji sticker. + * The sticker must belong to a sticker set created by the bot. Returns True on success. + * + * @param string $sticker File identifier of the sticker + * @param array $keywords A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters + * @param array $options Optional parameters + * @return bool + * @throws TelegramException + * @link https://core.telegram.org/bots/api#setstickerkeywords + * @noinspection PhpUnused + */ + public function setStickerKeywords(string $sticker, array $keywords, array $options=[]): bool + { + $this->sendRequest('setStickerKeywords', array_merge([ + 'sticker' => $sticker, + 'keywords' => $keywords + ], $options)); + + return true; + } } \ No newline at end of file