Discord.js client.commands.get(';kickembed';).execute//无法读取属性';执行';是未定义的//

Discord.js client.commands.get(';kickembed';).execute//无法读取属性';执行';是未定义的//,discord.js,bots,Discord.js,Bots,我实际上可以运行bot,它会让mi与其他3个命令交互,但是当尝试执行“kickembed”时,它会失败,并给出错误“client.commands.get('kickembed')。execute(message,args,Discord)” ^ 无法读取未定义的“execute”的属性 tbh,我试了所有的方法,我的小脑袋都不能解决这个问题,谢谢你 const client = new Discord.Client(); const prefix = ('^'); const fs =

我实际上可以运行bot,它会让mi与其他3个命令交互,但是当尝试执行“kickembed”时,它会失败,并给出错误“client.commands.get('kickembed')。execute(message,args,Discord)” ^ 无法读取未定义的“execute”的属性

tbh,我试了所有的方法,我的小脑袋都不能解决这个问题,谢谢你


const client = new Discord.Client();

const prefix = ('^');

const fs = require('fs');

client.commands = new Discord.Collection();

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

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

client.once('ready', () =>{
    console.log('Cataclysm is online, beep bop')
});

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();


            if(command === 'ping'){
            message.channel.send('pong!');
            } else if (command === 'welcome'){
            client.commands.get('welcome').execute(message, args);
            } else if (command === 'ban'){
            client.commands.get('Ban').execute(message, args);
            } else if (command === 'kick'){
            client.commands.get('kick').execute(message, args);
            } else if (command === 'kickembed'){
            client.commands.get('kickembed').execute(message, args, Discord);
            }


}); ~~~


and this is "kickembed"(where i have the problem i think)

~~~    const name = 'kick';
    const description = "This command kicks a member!";
    function execute(message, args, Discord) {


        const banembed = new Discord.MessageEmbed()

        .setColor('#ff3838')
        .setTitle('A user has been kicked')
        .setDescription('player (fix this plis) has been kicked by etc');

    message.channel.send(banembed);~~~

您的
kickembed
文件名称错误,它是
kick

所以应该是这样的:


常量名称='kickembed';
const description=“此命令踢成员!”;
函数执行(消息、参数、不一致){
const banembed=new Discord.MessageEmbed()
.setColor(“#ff3838”)
.setTitle('用户已被踢')
.setDescription(“玩家(修复此plis)已被etc踢出”);
message.channel.send(banembed);

标题有误导性:未定义的不是execute,而是
client.commands.get('kickembed')
嘿!我来回复你!但这不起作用…同样的错误。你对如何解决这个问题有什么其他想法吗?再次感谢!我想从你那里获得更多详细信息。请随时联系我,HellCatVN#1235当然,刚刚发送给你fr,(Minilink#8425)