From 7252854c44bbfaeed793bf600a9134be1c367cd1 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 6 Apr 2023 13:22:09 -0400 Subject: [PATCH] Added the ability to set different bot descriptions for different user languages using the method `\TgBotLib\Bot > setMyDescription()` --- CHANGELOG.md | 3 +++ src/TgBotLib/Bot.php | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 206b5b2..cf02355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [6.6.0] - Unreleased +### Added + * Added the ability to set different bot descriptions for different user languages using the method `\TgBotLib\Bot > setMyDescription()` + ### Changed * Removed unused `__destruct()` method from `\TgBotLib\Bot` * Added proper construction for `PollOption[]` objects in `TgBotLib\Objects\Telegram > Poll` diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index 44b6141..b5487ef 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -2134,6 +2134,28 @@ }, $this->sendRequest('getMyCommands', $options)); } + /** + * Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. + * Returns True on success. + * + * @param string|null $description New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. + * @param string|null $language_code A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. + * @param array $options + * @return bool + * @throws TelegramException + * @link https://core.telegram.org/bots/api#setmydescription + * @noinspection PhpUnused + */ + public function setMyDescription(?string $description=null, ?string $language_code=null, array $options=[]): bool + { + $this->sendRequest('setMyDescription', array_merge([ + 'description' => $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.