So I'm trying to have javascript match only the string "welcome" with a message containing that however I don't want it to only react when someone says "welcome" exactly. I think I have to use regex for this but I'm not sure and I've been pretty confused on it.
if (message.content.toLowerCase() == 'welcome') {
message.react(reactEmoji)
}
Theres my code. I've tried a few different versions of regex like "/welcome/i" however that did not work
I want something like the image below to get reacted on like this 1
Get the lowercase version of it and run String#includes() on it.
if (message.content.toLowerCase().includes('welcome')) {
message.react(reactEmoji)
}
Or you can use regex
if (/welcome/i.test(message.content)) {
message.react(reactEmoji)
}