Reputation: 121
Hello everyone I have begun working on my bot for discord and I am very new to this but I was hoping to get some help figuring out if it was possible to set a const or something that would evaluate the "help" in the first part of the if statement as "help" or something else of my choosing like "ayuda" so that way no matter if they write help or ayuda the if statement would work (without creating a different argument).
The reason I ask is I plan to have a few if statements that will use "help" in the argument so I would rather set a constant for them all in one go rather than seperately.
if(message.content === "help") {
message.channel.send('Need Help? As a moderator')
}
Any help is greatly appreciated!
Upvotes: 0
Views: 73
Reputation: 802
Yes, you can store all help alternatives in an array and check if user's content exists in that array.
const helpStrings = [
'help',
'ayuda',
'another one'
]
if (helpStrings.includes(message.content)) {
message.channel.send('Need Help? As a moderator')
}
Upvotes: 1