From 417b7f67c4fa458de88c3f62fb37da9896c95bee Mon Sep 17 00:00:00 2001 From: dev-737 <73829355+dev-737@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:01:05 +0530 Subject: [PATCH] Update create.ts --- src/Scripts/hub/create.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Scripts/hub/create.ts b/src/Scripts/hub/create.ts index fb1d5224..9e887e98 100644 --- a/src/Scripts/hub/create.ts +++ b/src/Scripts/hub/create.ts @@ -17,12 +17,14 @@ export async function execute(interaction: ChatInputCommandInteraction) { const iconUrl = interaction.options.getString('icon', true); const bannerUrl = interaction.options.getString('banner'); - const imgurIcons = iconUrl.match(/\bhttps?:\/\/i\.imgur\.com\/[A-Za-z0-9]+\.(?:jpg|jpeg|gif|png|bmp)\b/g); - const imgurBanners = bannerUrl?.match(/\bhttps?:\/\/i\.imgur\.com\/[A-Za-z0-9]+\.(?:jpg|jpeg|gif|png|bmp)\b/g); + const imgurRegex = /\bhttps?:\/\/i\.imgur\.com\/[A-Za-z0-9]+\.(?:jpg|jpeg|gif|png|bmp)\b/g; + + const imgurIcons = iconUrl.match(imgurRegex); + const imgurBanners = bannerUrl?.match(imgurRegex); if (!imgurIcons || imgurBanners === null) { return await interaction.reply({ - content: 'Please provide a valid imgur link for the icon and banner. It should start with `https://i.imgur.com/` and end with an image extension.', + content: 'Please provide a valid Imgur link for the icon and banner. It should start with `https://i.imgur.com/` and end with an image extension.', ephemeral: true, }); }