最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to end interaction silently? - Stack Overflow

programmeradmin2浏览0评论

So I have a 'say' mand, that doesn't reply back to the user, but just "says" whatever the user types. But it seems like my bot expects to reply back to the user, which I think is unnecessary in this case. Is there a way to just end the interaction without the bot timing out and saying an error occurred? I know deferReply exists, but that just makes the bot display the "Bot is thinking..." message. I just don't want any reply to be sent. Here is the relevant code:

  async execute(interaction) {
    await interaction.channel.send(interaction.options.getString("string"));
  }

EDIT: I believe the closest way to do this would be to send a message, then delete it immediatly after:

  async execute(interaction) {
    await interaction.reply({
      content: `.`,
    });
    await interaction.deleteReply();
    await interaction.channel.send(interaction.options.getString("string"));
  },

Discord really should add the ability to just silently end interactions like:

await interaction.noReply();

So I have a 'say' mand, that doesn't reply back to the user, but just "says" whatever the user types. But it seems like my bot expects to reply back to the user, which I think is unnecessary in this case. Is there a way to just end the interaction without the bot timing out and saying an error occurred? I know deferReply exists, but that just makes the bot display the "Bot is thinking..." message. I just don't want any reply to be sent. Here is the relevant code:

  async execute(interaction) {
    await interaction.channel.send(interaction.options.getString("string"));
  }

EDIT: I believe the closest way to do this would be to send a message, then delete it immediatly after:

  async execute(interaction) {
    await interaction.reply({
      content: `.`,
    });
    await interaction.deleteReply();
    await interaction.channel.send(interaction.options.getString("string"));
  },

Discord really should add the ability to just silently end interactions like:

await interaction.noReply();
Share Improve this question edited Dec 5, 2021 at 6:45 Koto asked Dec 4, 2021 at 4:01 KotoKoto 4505 silver badges21 bronze badges 3
  • 1 This only exists for MessageComponentInteractions - stackoverflow./questions/69902967/… – MrMythical Commented Dec 4, 2021 at 4:13
  • @MrMythical so I would have to implement some sort of system where I send a message and instantly delete it? – Koto Commented Dec 4, 2021 at 5:16
  • interaction.noReply() is definitely a must, but fortunately deferUpdate() works for my case – Federick Jonathan Commented Jul 30, 2022 at 11:06
Add a ment  | 

1 Answer 1

Reset to default 4

There is no real solution to not reply to a slash mand.

Below will only work for select menus and buttons.
<Interaction>.deferUpdate() acknowledges the interaction without doing anything else.
No errors or replies will be required after an interaction is acknowledged.

发布评论

评论列表(0)

  1. 暂无评论