From ae7facc255a743a3e85d451549e5b35a4e78b4e2 Mon Sep 17 00:00:00 2001 From: netkas Date: Thu, 14 Nov 2024 00:31:47 -0500 Subject: [PATCH] Add DeleteMessage method --- src/TgBotLib/Enums/Methods.php | 3 ++ src/TgBotLib/Methods/DeleteMessage.php | 38 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/TgBotLib/Methods/DeleteMessage.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 5864fc4..24eae2d 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -21,6 +21,7 @@ use TgBotLib\Methods\DeleteChatPhoto; use TgBotLib\Methods\DeleteChatStickerSet; use TgBotLib\Methods\DeleteForumTopic; + use TgBotLib\Methods\DeleteMessage; use TgBotLib\Methods\DeleteMyCommands; use TgBotLib\Methods\DeleteWebhook; use TgBotLib\Methods\EditChatInviteLink; @@ -200,6 +201,7 @@ case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation'; case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup'; case STOP_POLL = 'stopPoll'; + case DELETE_MESSAGE = 'deleteMessage'; /** * Executes a command on the provided bot with the given parameters. @@ -309,6 +311,7 @@ self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters), self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters), self::STOP_POLL => StopPoll::execute($bot, $parameters), + self::DELETE_MESSAGE => DeleteMessage::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/DeleteMessage.php b/src/TgBotLib/Methods/DeleteMessage.php new file mode 100644 index 0000000..93c0427 --- /dev/null +++ b/src/TgBotLib/Methods/DeleteMessage.php @@ -0,0 +1,38 @@ +value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id', + 'message_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file