0

I'm trying to make something like that: when a person writes certain words, the bot responds with a GIF image. Here is my code

const hayday = ('hayday', 'hay day', 'хей дей', 'хейдей', 'хэй дэй', 'хэйдэй') client.on('message', msg => { if (msg.content.toLowerCase().includes(hayday)) { msg.channel.send('https://tenor.com/view/hayday-gif-20485973'); } }) 

When I send any of options on const hayday bot just ignore me What's wrong? I'm on discord.js 12

1

1 Answer 1

0

I see 2 issues in your code.

1: Tables do not start and end with (), They start and end with []

2: You are checking if the entire array is found in the message

Try this code.

const hayday = ['hayday', 'hay day', 'хей дей', 'хейдей', 'хэй дэй', 'хэйдэй'] client.on('message', msg => { var found = false for(const val of hayday){ if(msg.content.toLowerCase().includes(val)){ found = true } } setTimeout(() => { if(found == true){ msg.channel.send('https://tenor.com/view/hayday-gif-20485973'); } }, 1000) }) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.