Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Not checking anything before or after the string "welcome"

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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)
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!