Javascript TypeError:无法读取属性';查找';或';获取';未定义的,Discord.js 12.4.1
运行节点时,会弹出此错误:Javascript TypeError:无法读取属性';查找';或';获取';未定义的,Discord.js 12.4.1,javascript,discord,discord.js,Javascript,Discord,Discord.js,运行节点时,会弹出此错误:TypeError:无法读取未定义的属性“find” 错误在这里: const cmd = client.command.find(command); if (!cmd) return; 事情是这样的: client.on('message', message => { if (message.author.bot) return; const args = message.content.slice(prefix.length).trim()
TypeError:无法读取未定义的属性“find”
错误在这里:
const cmd = client.command.find(command);
if (!cmd) return;
事情是这样的:
client.on('message', message => {
if (message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
const cmd = client.command.find(command);
if (!cmd) return;
cmd.run(client, message, args);
});
有人知道我能做些什么来解决这个问题吗?客户机
类没有命令属性:。为什么要使用client.command
,您在教程中看到了吗?您可能拼错了client.commands
@Lioness100 AFAIK,client
类中也没有commands
属性。您是否参考了本教程:?如果是这样,则client.commands
属性是在运行时设置的,并且不是API的一部分。@Seblor是的,我指的是教程。这是在客户机
对象上设置的一个非常常见的属性。