From 9e2e19d5938743aaa78e9403f56cdc97f9c9e506 Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 5 Nov 2024 19:24:25 -0500 Subject: [PATCH] Add BanChatMember method to TgBotLib --- src/TgBotLib/Enums/Methods.php | 3 ++ src/TgBotLib/Methods/BanChatMember.php | 41 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/TgBotLib/Methods/BanChatMember.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 79a0c76..285dd4b 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -5,6 +5,7 @@ use TgBotLib\Bot; use TgBotLib\Exceptions\TelegramException; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Methods\BanChatMember; use TgBotLib\Methods\Close; use TgBotLib\Methods\CopyMessage; use TgBotLib\Methods\CopyMessages; @@ -68,6 +69,7 @@ case SET_MESSAGE_REACTION = 'setMessageReaction'; case GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos'; case GET_FILE = 'getFile'; + case BAN_CHAT_MEMBER = 'banChatMember'; /** * Executes a command on the provided bot with the given parameters. @@ -111,6 +113,7 @@ self::SET_MESSAGE_REACTION => SetMessageReaction::execute($bot, $parameters), self::GET_USER_PROFILE_PHOTOS => GetUserProfilePhotos::execute($bot, $parameters), self::GET_FILE => GetFile::execute($bot, $parameters), + self::BAN_CHAT_MEMBER => BanChatMember::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/BanChatMember.php b/src/TgBotLib/Methods/BanChatMember.php new file mode 100644 index 0000000..cd3b0df --- /dev/null +++ b/src/TgBotLib/Methods/BanChatMember.php @@ -0,0 +1,41 @@ +sendRequest(Methods::BAN_CHAT_MEMBER->value, $parameters); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id', + 'user_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'until_date', + 'revoke_messages' + ]; + } + } \ No newline at end of file