【问题标题】:Client.application.commands.set not work discord.js v14Client.application.commands.set 不起作用 discord.js v14
【发布时间】:2022-10-14 03:18:47
【问题描述】:

我尝试使用client.application.commands.set 发布斜杠命令,但它不起作用。

slashCommands.map((value) => {
  const file = require(value);
  if (!file?.name) return;
  client.slashCommands.set(file.name, file);
  arrayOfSlashCommands.push(file);
  client.application.commands.set(arrayOfSlashCommands.name, arrayOfSlashCommands)
});

【问题讨论】:

  • arrayOfSlashCommands.name 是什么?因为对我来说它看起来像[].name,即undefined
  • 它是斜杠命令的名称。
  • console.log(arrayOfSlashCommands.name) 打印什么?
  • 它打印undefined
  • 因为数组没有名为name 的属性。我猜你想把file.name 放在这里。

标签: node.js discord.js


【解决方案1】:

如果您要注册斜杠命令,请关注this guide

【讨论】:

    猜你喜欢
    • 2022-11-25
    • 2022-12-05
    • 2022-12-14
    • 2022-11-11
    • 2022-10-13
    • 2018-04-24
    • 2018-01-13
    • 1970-01-01
    • 2022-01-05
    相关资源
    最近更新 更多