Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
fix: remove URLs from content before checking for banned words
Browse files Browse the repository at this point in the history
  • Loading branch information
Bashamega committed Jul 24, 2024
1 parent 9fc6b25 commit ce0192d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/alexjs/checkBannedWords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export const checkBannedWords = async (
): Promise<EmbedBuilder[]> => {
const embeds: EmbedBuilder[] = [];
try {
const urlPattern = /https?:\/\/[^\s]+/g;
const text: string = content.replace(urlPattern, '');
const config = await getBannedWordConfig(bot, serverId);
const checkWords = config?.bannedWordConfig
? config.bannedWordConfig
: BannedWordsOptions;
content.split(' ').forEach((word) => {
text.split(' ').forEach((word) => {
if (checkWords.includes(word.toLowerCase())) {
const embed = new EmbedBuilder();
embed.setTitle(`You used the word "${word}"`);
Expand Down

0 comments on commit ce0192d

Please sign in to comment.