【问题标题】:can someone help me with the following problem? (discord.js Discord Bot)有人可以帮我解决以下问题吗? (discord.js 不和谐机器人)
【发布时间】:2021-02-26 11:46:28
【问题描述】:

代码是:

module.exports = (client, message) => {
if (message.author.bot) return;

if (message.content.indexOf(client.config.prefix) !== 0) return;

const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();

const cmd = client.commands.get(command);

if (!cmd) return;

cmd.run(client, message, args);
};

错误信息是:

cmd.run(client, message, args);
    ^
TypeError: cmd.run is not a function

任何人都知道,我可以使用什么来代替运行,或者我可以如何解决问题?

【问题讨论】:

  • 您必须向我们展示您尝试执行的命令文件。奇怪的是,它导出的对象没有run 属性。

标签: discord discord.js bots


【解决方案1】:

我不知道您要做什么,因为client.commands 在我使用的任何版本的 discord.js 中都不存在,所以您可以查看您的这部分代码。

(如果您给我们更多的代码,也许我们可以为您提供更多帮助,这可能会为我们提供有关变量的信息,或者可能会提供有关您正在尝试做什么的更多信息。) 谢谢;)

【讨论】:

猜你喜欢
  • 2021-09-22
  • 1970-01-01
  • 2023-03-19
  • 1970-01-01
  • 2021-05-30
  • 2011-12-11
相关资源
最近更新 更多