【问题标题】:How do I make a say command?如何发出say命令?
【发布时间】:2023-04-06 01:13:01
【问题描述】:

我有这个.say 命令,它将使机器人响应用户输入的任何内容。例如,.say hello 应该让机器人回复 hello

但是,我的机器人目前以 .say hello 响应。如何阻止机器人在开头回复 .say

我正在使用Pylon SDK Aka 打字稿。

const commands = new discord.command.CommandGroup({
  defaultPrefix: "."
});

commands.on(
  "say",
  (args) => ({
    input: args.text(),
  }),
  async (message, { input }) => {
    await message.delete();
    await message.reply({
      content: message.content,
      allowedMentions: {},
    });
  }
);

【问题讨论】:

  • 不简单:message.reply(input); 为您工作吗?
  • 它的 pylon 是一个不和谐的机器人
  • 我从 pylon 文档中复制了以上内容。那应该可以吗?

标签: javascript typescript discord bots


【解决方案1】:

message.content是消息的原始内容,包括开头的.say。您要使用的是input,它将作为消息的输入(不包括前缀和命令)。

改用这个:

await message.reply({
  content: input,
  allowedMentions: {}
})

Here 是 Pylon 文档中一个非常相似的命令示例。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-07
    • 2021-06-20
    • 2016-09-19
    • 1970-01-01
    • 1970-01-01
    • 2020-09-29
    • 2021-04-24
    • 2016-03-17
    相关资源
    最近更新 更多