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

348
Views
How do I check for a word in a message, in discord js?

I'm trying to make a simple discord bot. How can I make it so it checks for a word inside a message? For example if somebody says "i love bananas" and the trigger word is banana, the bot responds with "same". All I could figure out is how to make it reply to a specific message (like only "banana"), how do I make something like the example I made?

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

0

discord.js v13.5.1

const client = new Client({
  intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});

const triggerWords = ['banana', 'fire', 'white'];

client.on('messageCreate', (message) => {
  if (message.author.bot) return false;

  triggerWords.forEach((word) => {
    if (message.content.includes(word)) {
      message.reply(message.content);
    }
  });
});

https://discord.js.org/#/docs/discord.js/stable/class/Client?scrollTo=e-messageCreate

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!