即使我的朋友有烫发,您也不允许使用该命令



我正在编码,需要帮助这是我的代码

const DiscordCommand = require("../../contracts/DiscordCommand");
const admins = ["445952068621041664", "398909948194586634"];
class OverrideCommand extends DiscordCommand {
onCommand(message) {
if (admins.includes(message.author.id)) {
let args = this.getArgs(message).join(" ");
if (args.length == 0) {
return message.reply(`No command specified`);
}
this.sendMinecraftMessage(`/${args}`);
message.reply(``/${args}` has been executed`);
} else message.reply(`You dont have permissions to use this command!`);
}
}
module.exports = OverrideCommand;

我在这里试图做的是使两个人可以执行命令"+覆盖";在带有2个id的const admins中,当我尝试使用该命令时,第一个是我的,第二个是我朋友,它运行良好,但当我朋友执行它时,它会给我这个错误

/app/src/discord/commands/OverrideCommand.js:3
const admins = ['445952068621041664', '398909948194586634]
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18) ```

如果有人能帮我,我真的很感激。我对编码很陌生

编辑:问题已经改变了,即使数组管理员在图片的url中有他的id,它也不会让我的朋友使用该命令(如果需要的话(https://prnt.sc/10uf39r

Admins数组是无效的json

['445952068621041664', '398909948194586634]

应该是

['445952068621041664', '398909948194586634']

您可以通过检查if来确定消息的作者是IDID

if(message.author.id != ID || message.author.id != ID){
message.reply(`You dont have permissions to use this command!`)
}

最新更新