[英]You're not allowed to use the command even tho my friend has perms
我正在編碼,需要幫助 這是我的代碼
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 個人可以執行命令“+覆蓋”,就像在 const admins 中使用 2 個 id 一樣,第一個是我的,第二個是我的朋友,當我嘗試使用該命令時它工作正常但是當我的朋友執行它時,它給了我這個錯誤
/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) ```
如果有人可以幫助我,我將不勝感激 我對編碼很陌生
編輯:問題已經改變,即使陣列管理員有他的 id innit url 到圖片(如果需要) https://prnt.sc/10uf39r
管理員數組無效 json
['445952068621041664', '398909948194586634\]
應該
['445952068621041664', '398909948194586634']
if
可以通過檢查消息的作者是ID
還是ID
來做到這一點
if(message.author.id != ID || message.author.id != ID){
message.reply(`You dont have permissions to use this command!`)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.