Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 我的discord.js代码有什么问题?_Node.js_Discord.js - Fatal编程技术网

Node.js 我的discord.js代码有什么问题?

Node.js 我的discord.js代码有什么问题?,node.js,discord.js,Node.js,Discord.js,我编写了与bot权限部分相关的代码,该代码是正确的,但几分钟后bot出现错误,无法工作。这个错误 因为代码的数量太多了,我不能在这里写,但我可以留下错误的部分 if(command.permissions.length){ let invalidPerms = [] for(const perm of command.permissions){ if(!validPermissions.includes(perm)){

我编写了与bot权限部分相关的代码,该代码是正确的,但几分钟后bot出现错误,无法工作。这个错误

因为代码的数量太多了,我不能在这里写,但我可以留下错误的部分

        if(command.permissions.length){
      let invalidPerms = []
      for(const perm of command.permissions){
        if(!validPermissions.includes(perm)){
          return console.log(`Invalid Permissions ${perm}`);
        }
        if(!message.member.hasPermission(perm)){
          invalidPerms.push(perm);
        }
      }
      if (invalidPerms.length){
        return message.channel.send(new Discord.MessageEmbed() .setDescription('<a:poker:840226458566918185> You do not have access to this command! this command for \`${invalidPerms}\`') .setColor('RED'));
      }
    }
if(command.permissions.length){
设invalidPerms=[]
for(const perm of command.permissions){
如果(!validPermissions.includes(perm)){
返回console.log(`Invalid Permissions${perm}`);
}
如果(!message.member.hasPerm)){
无效项推送(perm);
}
}
if(无效术语长度){
返回message.channel.send(new Discord.MessageEmbed().setDescription('您无权访问此命令!此命令用于\`${invalidPerms}\`')。setColor('RED');
}
}

我相信,您的机器人没有在服务器上进行身份验证,权限也没有到达


您应该将console.log设置为permissions and debug。

我们不知道
命令应该是什么,没有任何代码我们就无法真正帮助您。