From c535977bac4f0bace841829a5ceef237d41f601d Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 6 Nov 2024 00:16:34 -0500 Subject: [PATCH] Add SetChatAdministratorCustomTitle method --- src/TgBotLib/Enums/Methods.php | 3 ++ .../SetChatAdministratorCustomTitle.php | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 5cfea81..455190e 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -36,6 +36,7 @@ use TgBotLib\Methods\SendVideo; use TgBotLib\Methods\SendVideoNote; use TgBotLib\Methods\SendVoice; + use TgBotLib\Methods\SetChatAdministratorCustomTitle; use TgBotLib\Methods\SetMessageReaction; use TgBotLib\Methods\SetWebhook; use TgBotLib\Methods\UnbanChatMember; @@ -76,6 +77,7 @@ case UNBAN_CHAT_MEMBER = 'unbanChatMember'; case RESTRICT_CHAT_MEMBER = 'restrictChatMember'; case PROMOTE_CHAT_MEMBER = 'promoteChatMember'; + case SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE = 'setChatAdministratorCustomTitle'; /** * Executes a command on the provided bot with the given parameters. @@ -123,6 +125,7 @@ self::UNBAN_CHAT_MEMBER => UnbanChatMember::execute($bot, $parameters), self::RESTRICT_CHAT_MEMBER => RestrictChatMember::execute($bot, $parameters), self::PROMOTE_CHAT_MEMBER => PromoteChatMember::execute($bot, $parameters), + self::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE => SetChatAdministratorCustomTitle::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php b/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php new file mode 100644 index 0000000..d612506 --- /dev/null +++ b/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php @@ -0,0 +1,39 @@ +sendRequest(Methods::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE->value, $parameters); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id', + 'user_id', + 'custom_title' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file