From 2aca204f1682d11382e2dac486d5cae026753c04 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 6 Nov 2024 17:10:01 -0500 Subject: [PATCH] Add PinChatMessage method --- src/TgBotLib/Enums/Methods.php | 3 ++ src/TgBotLib/Methods/PinChatMessage.php | 41 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/TgBotLib/Methods/PinChatMessage.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 3dab696..2b615b3 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -27,6 +27,7 @@ use TgBotLib\Methods\GetUserProfilePhotos; use TgBotLib\Methods\GetWebhookInfo; use TgBotLib\Methods\Logout; + use TgBotLib\Methods\PinChatMessage; use TgBotLib\Methods\PromoteChatMember; use TgBotLib\Methods\RestrictChatMember; use TgBotLib\Methods\RevokeChatInviteLink; @@ -108,6 +109,7 @@ case DELETE_CHAT_PHOTO = 'deleteChatPhoto'; case SET_CHAT_TITLE = 'setChatTitle'; case SET_CHAT_DESCRIPTION = 'setChatDescription'; + case PIN_CHAT_MESSAGE = 'pinChatMessage'; /** * Executes a command on the provided bot with the given parameters. @@ -171,6 +173,7 @@ self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters), self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters), self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters), + self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/PinChatMessage.php b/src/TgBotLib/Methods/PinChatMessage.php new file mode 100644 index 0000000..2105bf1 --- /dev/null +++ b/src/TgBotLib/Methods/PinChatMessage.php @@ -0,0 +1,41 @@ +value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id', + 'message_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'business_connection_id', + 'disable_notification' + ]; + } + } \ No newline at end of file