Javascript 如何创建可检测为多个项目的变量

Javascript 如何创建可检测为多个项目的变量,javascript,discord,discord.js,Javascript,Discord,Discord.js,我正在我的服务器上编写一个discord bot,我想添加一个功能,它可以响应人们的请求。我想让我的机器人能够检测到用户问候的多种方式,并让它回敬他们。 bot.on('message', msg=>{ if(msg.content.includes(“hi” or? “hello” or? “hey”)){ msg.reply(“hi” or? “hello” or? “hey”); } }) 它不允许用户在消息中发布其他内容,以便bot响应。您可以详细说明可以

我正在我的服务器上编写一个discord bot,我想添加一个功能,它可以响应人们的请求。我想让我的机器人能够检测到用户问候的多种方式,并让它回敬他们。

bot.on('message', msg=>{
   if(msg.content.includes(“hi” or? “hello” or? “hey”)){
      msg.reply(“hi” or? “hello” or? “hey”);
   }
})

它不允许用户在消息中发布其他内容,以便bot响应。您可以详细说明
可以检测为多个项目吗?
const greetings = ['hi', 'hello', 'hey'];

if (greetings.includes(msg.content)) {...}
const greetings = {
"hi": "hi",
"hello":"hello"
.....
}

if (greetings[msg.content]) {}
if (substrings.some(v => str.includes(v))) {
    // There's at least one
}