如何将 2 个不一致 ID 放入 if(message.author.id !=) 语句中

How can I put 2 discord ids inside a if(message.author.id !=) statement

你好,我一直在尝试 运行 这段代码并尝试重新编码多次,但每当我尝试将 2 个 ID 放入 if(message.author.id != ownerid) return message.channel.send("您无权访问此命令");它只注册了 1 个 ID 这是我当前的代码:

client.on('message', message => {
    if (message.content === prefix + 'listservers') {
    if(message.author.id != ownerid && altid) return message.channel.send("You don't have access to this command");
//rest of the code

}})

您有几个不同的选择。这是我的做法,使用数组和 Array.includes():

const allowedUsers = ["user id 1", "user id 2"]

client.on('message', message => {
    if (message.content === prefix + 'listservers') {
    if(!allowedUsers.includes(message.author.id)) return message.channel.send("You don't have access to this command");
//rest of the code

}})