Node.js TypeError:无法读取属性';执行';未定义的[不协调机器人]
我得到了这个特定代码块中的错误Node.js TypeError:无法读取属性';执行';未定义的[不协调机器人],node.js,discord,discord.js,Node.js,Discord,Discord.js,我得到了这个特定代码块中的错误 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.
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 == 'reactionroles'){
client.commands.get('reactionroles').execute(message, args, Discord, client);
}
});
我必须将reactionroles.js的代码放入一个粘贴箱中。
将
反应角色
块更改为:
else if (command == 'reactionroles')
client.commands.get('reactionrole').execute(message, args, Discord, client);
注意,该文件名为reactionroles.js
,但其内部方法名为reactionrole
。因此,它找不到任何名为reactionroles
的方法。按照reactionroles.js
文件中的指定,该方法不包含尾随的s
:
module.exports = {
name: 'reactionrole',
description: "Set up a reaction role message",