From 1661e744abd18a41436c47b96bf37e04c9dd9113 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 6 Nov 2024 17:14:20 -0500 Subject: [PATCH] Add LeaveChat method to bot API --- src/TgBotLib/Enums/Methods.php | 3 +++ src/TgBotLib/Methods/LeaveChat.php | 37 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/TgBotLib/Methods/LeaveChat.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index c609912..037ba7c 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -26,6 +26,7 @@ use TgBotLib\Methods\GetUpdates; use TgBotLib\Methods\GetUserProfilePhotos; use TgBotLib\Methods\GetWebhookInfo; + use TgBotLib\Methods\LeaveChat; use TgBotLib\Methods\Logout; use TgBotLib\Methods\PinChatMessage; use TgBotLib\Methods\PromoteChatMember; @@ -114,6 +115,7 @@ case PIN_CHAT_MESSAGE = 'pinChatMessage'; case UNPIN_CHAT_MESSAGE = 'unpinChatMessage'; case UNPIN_ALL_CHAT_MESSAGES = 'unpinAllChatMessages'; + case LEAVE_CHAT = 'leaveChat'; /** * Executes a command on the provided bot with the given parameters. @@ -180,6 +182,7 @@ self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters), self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters), self::UNPIN_ALL_CHAT_MESSAGES => UnpinAllChatMessages::execute($bot, $parameters), + self::LEAVE_CHAT => LeaveChat::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/LeaveChat.php b/src/TgBotLib/Methods/LeaveChat.php new file mode 100644 index 0000000..537c923 --- /dev/null +++ b/src/TgBotLib/Methods/LeaveChat.php @@ -0,0 +1,37 @@ +value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file