Skip to content

Commit

Permalink
Update create.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 authored Jul 4, 2023
1 parent a8343fd commit be66e34
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Scripts/hub/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
Expand Down

0 comments on commit be66e34

Please sign in to comment.