Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript TypeError:无法读取属性';查找';或';获取';未定义的,Discord.js 12.4.1_Javascript_Discord_Discord.js - Fatal编程技术网

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是的,我指的是教程。这是在
客户机
对象上设置的一个非常常见的属性。