From 91770ecbf6e9b4469040fe03fb4ed0e93edfd374 Mon Sep 17 00:00:00 2001 From: netkas Date: Thu, 14 Nov 2024 00:27:18 -0500 Subject: [PATCH] Add EditMessageReplyMarkup method --- src/TgBotLib/Enums/Methods.php | 3 + .../Methods/EditMessageReplyMarkup.php | 55 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/TgBotLib/Methods/EditMessageReplyMarkup.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 7fa5fb8..c71cdae 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -30,6 +30,7 @@ use TgBotLib\Methods\EditMessageCaption; use TgBotLib\Methods\EditMessageLiveLocation; use TgBotLib\Methods\EditMessageMedia; + use TgBotLib\Methods\EditMessageReplyMarkup; use TgBotLib\Methods\EditMessageText; use TgBotLib\Methods\ExportChatInviteLink; use TgBotLib\Methods\ForwardMessage; @@ -196,6 +197,7 @@ case EDIT_MESSAGE_MEDIA = 'editMessageMedia'; case EDIT_MESSAGE_LIVE_LOCATION = 'editMessageLiveLocation'; case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation'; + case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup'; /** * Executes a command on the provided bot with the given parameters. @@ -303,6 +305,7 @@ self::EDIT_MESSAGE_MEDIA => EditMessageMedia::execute($bot, $parameters), self::EDIT_MESSAGE_LIVE_LOCATION => EditMessageLiveLocation::execute($bot, $parameters), self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters), + self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/EditMessageReplyMarkup.php b/src/TgBotLib/Methods/EditMessageReplyMarkup.php new file mode 100644 index 0000000..688ffe8 --- /dev/null +++ b/src/TgBotLib/Methods/EditMessageReplyMarkup.php @@ -0,0 +1,55 @@ +toArray()); + } + elseif (is_array($parameters['reply_markup'])) + { + $parameters['reply_markup'] = json_encode($parameters['reply_markup']); + } + } + + return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::EDIT_MESSAGE_REPLY_MARKUP->value, $parameters))); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return null; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'business_connection_id', + 'chat_id', + 'message_id', + 'inline_message_id', + 'reply_markup' + ]; + } + } \ No newline at end of file