discord.js find word inside comment 1

discord.js find word inside comment

var words = ["insert", "your", "words"]

for (var i=0; i < words.length; i++) {

 if (message.content.includes(words[i])) {

  // YOUR CODE

 }

}

Here is what the above code is Doing:
1. It creates an array of words that you want to check for.
2. It loops through each word in the array.
3. It checks if the message content includes the word.
4. If it does, it runs the code inside the if statement.

You can add as many words as you want to the array.

Similar Posts