From c61c37be02a5fd83b99d2d4fd17d35eeefab5f56 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 13 Nov 2024 21:47:02 -0500 Subject: [PATCH] Add SetMyDefaultAdministratorRights --- src/TgBotLib/Enums/Methods.php | 3 ++ .../SetMyDefaultAdministratorRights.php | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 30bfb72..6c61ae0 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -81,6 +81,7 @@ use TgBotLib\Methods\SetChatTitle; use TgBotLib\Methods\SetMessageReaction; use TgBotLib\Methods\SetMyCommands; + use TgBotLib\Methods\SetMyDefaultAdministratorRights; use TgBotLib\Methods\SetMyDescription; use TgBotLib\Methods\SetMyName; use TgBotLib\Methods\SetMyShortDescription; @@ -182,6 +183,7 @@ case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription'; case SET_CHAT_MENU_BUTTON = 'setChatMenuButton'; case GET_CHAT_MENU_BUTTON = 'getChatMenuButton'; + case SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'setMyDefaultAdministratorRights'; /** * Executes a command on the provided bot with the given parameters. @@ -282,6 +284,7 @@ self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters), self::SET_CHAT_MENU_BUTTON => SetChatMenuButton::execute($bot, $parameters), self::GET_CHAT_MENU_BUTTON => GetChatMenuButton::execute($bot, $parameters), + self::SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS => SetMyDefaultAdministratorRights::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php b/src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php new file mode 100644 index 0000000..94fdfc7 --- /dev/null +++ b/src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php @@ -0,0 +1,43 @@ +toArray()); + } + + return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS->value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return null; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'rights', + 'for_channels' + ]; + } + } \ No newline at end of file