From 94d8922a496e1f687fc54a73f8514af189b12836 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 6 Nov 2024 17:11:45 -0500 Subject: [PATCH] Add method to unpin chat messages --- src/TgBotLib/Enums/Methods.php | 3 ++ src/TgBotLib/Methods/UnpinChatMessage.php | 40 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/TgBotLib/Methods/UnpinChatMessage.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 2b615b3..62ad53e 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -56,6 +56,7 @@ use TgBotLib\Methods\SetWebhook; use TgBotLib\Methods\UnbanChatMember; use TgBotLib\Methods\UnbanChatSenderChat; + use TgBotLib\Methods\UnpinChatMessage; enum Methods : string { @@ -110,6 +111,7 @@ case SET_CHAT_TITLE = 'setChatTitle'; case SET_CHAT_DESCRIPTION = 'setChatDescription'; case PIN_CHAT_MESSAGE = 'pinChatMessage'; + case UNPIN_CHAT_MESSAGE = 'unpinChatMessage'; /** * Executes a command on the provided bot with the given parameters. @@ -174,6 +176,7 @@ self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters), self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters), self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters), + self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/UnpinChatMessage.php b/src/TgBotLib/Methods/UnpinChatMessage.php new file mode 100644 index 0000000..33c5edc --- /dev/null +++ b/src/TgBotLib/Methods/UnpinChatMessage.php @@ -0,0 +1,40 @@ +value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'business_connection_id', + 'message_id' + ]; + } + } \ No newline at end of file