命令处理程序不工作|Discord JS v12



我试图构建一个命令处理程序,但无法运行命令。TypeError: Cannot read property 'get' of undefined

const args = message.content.slice(bot_info.prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
let command = client.command.get(cmd);
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (command) command.run(client, message, args);

如果是commandundefined,则表示消息不是由命令名启动的。我猜不出result是什么,所以我认为它是command

问题是let command = client.command.get(cmd);我忘了键入s。它与client.commands.get(cmd);运行得很好

最新更新