From 8730f82abf08ad066529302b02fa8069e0cbb769 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 6 Apr 2023 13:39:51 -0400 Subject: [PATCH] Added the ability to set different bot short descriptions for different user languages using the method `\TgBotLib\Bot > setMyShortDescription()` see [setMyShortDescription](https://core.telegram.org/bots/api#setmyshortdescription) for more information. --- CHANGELOG.md | 5 ++++- src/TgBotLib/Bot.php | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60e6463..25c737b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added the ability to set different bot descriptions for different user languages using the method `\TgBotLib\Bot > setMyDescription()` + see [setMyDescription](https://core.telegram.org/bots/api#setmydescription) for more information. * Added the ability to get the current bot description in the given language as the class [BotDescription](https://core.telegram.org/bots/api#botdescription) - using the method `\TgBotLib\Bot > getMyDescription()` + using the method `\TgBotLib\Bot > getMyDescription()` see [getMyDescription](https://core.telegram.org/bots/api#getmydescription) for more information. + * Added the ability to set different bot short descriptions for different user languages using the method `\TgBotLib\Bot > setMyShortDescription()` + see [setMyShortDescription](https://core.telegram.org/bots/api#setmyshortdescription) for more information. ### Changed * Removed unused `__destruct()` method from `\TgBotLib\Bot` diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index d31f7af..f24e8f9 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -2173,6 +2173,28 @@ ], $options))); } + /** + * Use this method to change the bot's short description, which is shown on the bot's profile page and is sent + * together with the link when users share the bot. Returns True on success. + * + * @param string|null $short_description New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. + * @param string|null $language_code A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. + * @param array $options + * @return bool + * @throws TelegramException + * @link https://core.telegram.org/bots/api#setmyshortdescription + * @noinspection PhpUnused + */ + public function setMyShortDescription(?string $short_description=null, ?string $language_code=null, array $options=[]): bool + { + $this->sendRequest('setMyShortDescription', array_merge([ + 'short_description' => $short_description, + 'language_code' => $language_code + ], $options)); + + return true; + } + /** * Use this method to change the bot's menu button in a private chat, or the default menu button. * Returns True on success.