diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 3638052..336969f 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -10,6 +10,7 @@ use TgBotLib\Methods\Close; use TgBotLib\Methods\CopyMessage; use TgBotLib\Methods\CopyMessages; + use TgBotLib\Methods\CreateChatInviteLink; use TgBotLib\Methods\DeleteWebhook; use TgBotLib\Methods\ExportChatInviteLink; use TgBotLib\Methods\ForwardMessage; @@ -86,6 +87,7 @@ case UNBAN_CHAT_SENDER_CHAT = 'unbanChatSenderChat'; case SET_CHAT_PERMISSIONS = 'setChatPermissions'; case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink'; + case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink'; /** * Executes a command on the provided bot with the given parameters. @@ -138,6 +140,7 @@ self::UNBAN_CHAT_SENDER_CHAT => UnbanChatSenderChat::execute($bot, $parameters), self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters), self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters), + self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/CreateChatInviteLink.php b/src/TgBotLib/Methods/CreateChatInviteLink.php new file mode 100644 index 0000000..fcc4803 --- /dev/null +++ b/src/TgBotLib/Methods/CreateChatInviteLink.php @@ -0,0 +1,42 @@ +sendRequest(Methods::CREATE_CHAT_INVITE_LINK->value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'name', + 'expire_date', + 'member_limit', + 'creates_join_request' + ]; + } + } \ No newline at end of file