I am doing a little bot on javascript that should detect what i write and give an answer. In this case this command "look" has several arguments/parameters like a, b and c. I want an affirmative answer only if the argument/parameter that i say its inside "look". And a negative one if is not. I guessed that this is made by using "if" but i cant figure how so.
Example... The const with its arguments/parameters:
const hi = [ 'a', 'b, 'c' ] // This has worked for me before.
What i actually expect from her to say:
look a
if (args[0] == "hi") return reply('Done, its there! :D')
if (!args[0] == "hi") return reply('Its not there. I cant make magic things.')
If i say "look z" she should say the second answer.
But for some reason (Obviusly im doing something wrong) on both she doesnt do anything and keeps executing the next code she has.
You're testing if args[0] is the word hi, not if it's in the array with that name. So it will only work if you write look hi.
Use includes() to test if something is in an array, and don't put quotes around the variable name.
if (hi.includes(args[0])) {
return reply('Done, its there! :D');
} else {
return reply('Its not there. I cant make magic things.')
}