I'm trying to check if a message includes a certain word. Now, I know it's message.content.includes, but mine is a little bit different and it's not working.
Heres the code:
client.on('message', (message) => {
// Right here is where it's not working. If I remove the includes part,
// it can detect the word if it's by its self. But if I'm saying
// something like "Hahaha Heck" it won't see it.
if (/^H[A-Za-z]{2}k$/.test(message.content.includes)) {
message.delete();
message.reply('Okay');
message.member.roles.add('805088740737417256');
}
});
Does anybody know the solution to this?
(If you're wondering what the /^H[A-Za-z]{2}k$/ part is the regex pattern and it looks for any words that fit with anything between the 2 letters H and k.)