Javascript TypeError:bot.commands.get不是函数

Javascript TypeError:bot.commands.get不是函数,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,我怎样才能解决这个问题? 启动bot时,在控制台中我看到: TypeError:bot.commands.get不是函数(183:34) 如果您试图创建一个命令处理程序,请使用 拿出 let messageArray = message.content.split(" "); let cmd = messageArray[0]; let args = messageArray.slice(1); let commandfile = bot.commands.get(cmd.slice(bot.

我怎样才能解决这个问题? 启动bot时,在控制台中我看到:

TypeError:bot.commands.get不是函数(183:34)


如果您试图创建一个命令处理程序,请使用

拿出

let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);

let commandfile = bot.commands.get(cmd.slice(bot.config.PREFIX.length));
if(commandfile) commandfile.run(bot,message,args);
我相信您的错误与messageArray是一个对象有关,您不能运行对象,除非您通过函数运行它

例如

var i ;
i.run();
我不是像这里这样的函数

function imgurLinks (message) {
 return message.match(/https?:\/\/www\.tenor\.co\/[^\s]+/g)
}
这将通过函数运行成员的消息,例如
imgurlinks(message.content)

var i ;
i.run();
function imgurLinks (message) {
 return message.match(/https?:\/\/www\.tenor\.co\/[^\s]+/g)
}