This code I found to delete bad words haha, But I just want it to delete discord links aka only invite links.
As you can see under bad words "https://discord.gg/"
I want it to delete it but it does nothing because in the message it had :,//,. so it does nothing can someone help me. this is JS btw
CODE -----------------------------
var badWords = [
"https://discord.gg/"
];
bot.on('message', message => {
var words = message.content.toLowerCase().trim().match(/\w+|\s+|[^\s\w]+/g);
var containsBadWord = words.some(word => {
return badWords.includes(word);
});
if (containsBadWord) {
message.delete(1);
message.channel.send("Advertising on this server is now allowed please read the rules.!");
}
});
CODE END -----------------------------
As you can see under bad words "https://discord.gg/"
I want it to delete it but it does nothing because in the message it had :,//,. so it does nothing can someone help me. this is JS btw
CODE -----------------------------
var badWords = [
"https://discord.gg/"
];
bot.on('message', message => {
var words = message.content.toLowerCase().trim().match(/\w+|\s+|[^\s\w]+/g);
var containsBadWord = words.some(word => {
return badWords.includes(word);
});
if (containsBadWord) {
message.delete(1);
message.channel.send("Advertising on this server is now allowed please read the rules.!");
}
});
CODE END -----------------------------
