TypeError:无法读取未定义命令处理程序的属性“ set”

时间:2020-11-04 00:50:52

标签: node.js typeerror

当我尝试制作高级命令处理程序时出现此错误

这是我的脚本:

const Discord = require(`discord.js`);
const client = new Discord.Client();
const prefix = '!'
const fs = require(`fs`);
client.commands = new Discord.Collection();

const commandFile = fs.readdirSync('./scripts/').filter(file => file.endsWith('.js'));
for(const file of commandFile){
    const command = require(`./scripts/${file}`);

    client.command.set(command.name, command)
}

client.once('ready', ()=>{
    console.log('Succesfully Started Scriptz')
    client.user.setActivity("Scripts", {
        type: "WATCHING"
    })
})

client.login的结尾部分我已将其删除,因此您无法访问我的漫游器

1 个答案:

答案 0 :(得分:0)

我认为您在命令末尾忘记了boolean validate()

应改为s