I\'m making a discord bot and I\'m trying to make a forbidden words list using arrays. I can\'t seem to find out how to make this work. Here\'s my current code:
The code you posted checks if the entire message's content is a member of your array. To accomplish what you want, loop over the array and check if the message contains each item:
for (var i = 0; i < forbidenWords.length; i++) {
if (message.content.includes(forbidenWords[i])) {
// message.content contains a forbidden word;
// delete message, log, etc.
break;
}
}
(By the way, you misspelled "forbidden" in your variable name)