Skip to content

Commit

Permalink
fix(hub): disallow names to contain words that discord doesn't like
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Sep 19, 2023
1 parent 546af3c commit 798802d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Scripts/hub/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ export async function execute(interaction: ChatInputCommandInteraction) {
});
}

// if hubName contains "discord", "clyde" "```" then return
if (hubName.match(/discord|clyde|```/gi)) {
return await interaction.reply({
content: 'Hub name can not contain `discord`, `clyde` or \\`\\`\\` . Please choose another name.',
ephemeral: true,
});
}

const db = getDb();
const hubs = await db.hubs.findMany({ where: { OR: [{ ownerId: interaction.user.id }, { name: hubName }] } });

Expand Down

0 comments on commit 798802d

Please sign in to comment.