From 9817608eb77971f54c7fa88258ee516ec2b8a7ae Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 6 Nov 2024 15:06:07 -0500 Subject: [PATCH] Add CreateChatSubscriptionInviteLink method --- src/TgBotLib/Enums/Methods.php | 3 ++ .../CreateChatSubscriptionInviteLink.php | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index ea00f9e..359fa97 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -11,6 +11,7 @@ use TgBotLib\Methods\CopyMessage; use TgBotLib\Methods\CopyMessages; use TgBotLib\Methods\CreateChatInviteLink; + use TgBotLib\Methods\CreateChatSubscriptionInviteLink; use TgBotLib\Methods\DeleteWebhook; use TgBotLib\Methods\EditChatInviteLink; use TgBotLib\Methods\ExportChatInviteLink; @@ -90,6 +91,7 @@ case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink'; case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink'; case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink'; + case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink'; /** * Executes a command on the provided bot with the given parameters. @@ -144,6 +146,7 @@ self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters), self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters), self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters), + self::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK => CreateChatSubscriptionInviteLink::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php b/src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php new file mode 100644 index 0000000..e42e2d8 --- /dev/null +++ b/src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php @@ -0,0 +1,44 @@ +value, $parameters)) + ); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id', + 'subscription_period', + 'subscription_price' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'name' + ]; + } + } \ No newline at end of file