Javascript 为什么我会出错?TypeError:“无法读取未定义的属性'execute'”

Javascript 为什么我会出错?TypeError:“无法读取未定义的属性'execute'”,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,在main.js中,不是所有内容都有问题,而是有什么问题: 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().toLowerCa

在main.js中,不是所有内容都有问题,而是有什么问题:

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'){
        client.commands.get('ping').execute(message, args);
    }  else if (command == 'hello'){
        client.commands.get('hello').execute(message, args);
    }  else if (command == 'command'){
        client.commands.get('command').execute(message, args, Discord);
    }  else if (command == 'clear'){
        client.commands.get('clear').execute(message, args);
    }  else if (command == 'kick'){
        client.commands.get('kick').execute(message, args);
    }  else if (command == 'ban'){
        client.commands.get('ban').execute(message, args);
    }  else if (command == 'mute'){
        client.commands.get('mute').execute(message,args);
    }  else if (command == 'wake'){
        client.commands.get('wake up').execute(message,args);
    }  else if (command == 'play'){
        client.commands.get('play').execute(message, args);
    }  else if (command == 'leave'){
        client.commands.get('leave').execute(message, args);
    }  else if (command == 'coin'){
        client.commands.get('coin').execute(message, args, Discord);
    }  else if (command == 'avatar'){
        client.commands.get('avatar').execute(client, message, args);
    }  else if (command == 'weather'){
        client.commands.get('weather').execute(client, message, args);
    }  else if (command == 'slowmode'){
        client.commands.get('slowmode').execute(message, args);
    }  else if (command == 'youtube'){
        client.commands.get('youtube').execute(message, args);
    }  else if (command == 'kill'){
        client.commands.get('kill').execute(message, args);
    }  else if (command == 'beep'){
        client.commands.get('beep').execute(message, args, Discord);
    }  else if (command == 'spam'){
        client.commands.get('spam').execute(message, args, Discord);
    }  else if (command == 'reactionrole'){
        client.commands.get('reactionrole').execute(message, args, Discord);
    } 
});
reactionrole.js中的内容:

module.exports = {
    name: 'reactionrole',
    description: "Sets up a reaction role message!",
    async execute(message, args, Discord, client) {
        const channel = 'Your issue is super simple to solve, you are mixing up events and commands with each other please move 

 client.on('messageReactionAdd', async (reaction, user) => {
            if (reaction.message.partial) await reaction.message.fetch();
            if (reaction.partial) await reaction.fetch();
            if (user.bot) return;
            if (!reaction.message.guild) return;
 
            if (reaction.message.channel.id == channel) {
                if (reaction.emoji.name === pepepog) {
                    await reaction.message.guild.members.cache.get(user.id).roles.add(yellowTeamRole);
                }
            } else {
                return;
            }
 
        });
 
        client.on('messageReactionRemove', async (reaction, user) => {
 
            if (reaction.message.partial) await reaction.message.fetch();
            if (reaction.partial) await reaction.fetch();
            if (user.bot) return;
            if (!reaction.message.guild) return;
 
 
            if (reaction.message.channel.id == channel) {
                if (reaction.emoji.name === pepepog) {
                    await reaction.message.guild.members.cache.get(user.id).roles.remove(yellowTeamRole);               }
            } else {
                return;
            }
        });
    }

 // To your mainfile as it is an event and furthermore check if reactionrole.js is being exported properly~! Hope it helps
module.exports={ 名称:“reactionrole”, 描述:设置反应角色消息!, 异步executemessage、args、Discord、客户端{
const channel='您的问题非常容易解决,您将事件和命令相互混淆,请移动

client.on'messageReactionAdd',异步反应,用户=>{ if reaction.message.partial wait reaction.message.fetch; if reaction.partial wait reaction.fetch; 如果user.bot返回; if!reaction.message.guild return; 如果reaction.message.channel.id==通道{ 如果reaction.emoji.name===pepepog{ 等待反应。message.guild.members.cache.getuser.id.roles.addyellowTeamRole; } }否则{ 回来 } }; client.on'messageReactionRemove',异步反应,用户=>{ if reaction.message.partial wait reaction.message.fetch; if reaction.partial wait reaction.fetch; 如果user.bot返回; if!reaction.message.guild return; 如果reaction.message.channel.id==通道{ 如果reaction.emoji.name===pepepog{ 等待反应。message.guild.members.cache.getuser.id.roles.removeyellowTeamRole;} }否则{ 回来 } }; } //将其作为事件导出到主文件,并进一步检查reactionrole.js是否正确导出~!希望有帮助
client.commands.get'reactionrole'返回未定义。此外,对于将来的问题,请完全格式化代码,并且只包含与您所询问的内容相关的行。您可能希望向我们显示您得到的错误并格式化代码,请^^