首页 > 解决方案 > Discord.js:[对象对象]

问题描述

我一直在努力改进我的票务系统并解决了这个问题: 问题

我的代码是:

    await button.clicker.fetch();
    if (!button.clicker.member.roles.cache.has("859507507596230736")) return button.reply.send("Only staff can close the ticket.", true)
    var embed = new Discord.MessageEmbed()
    .setTitle("Are you sure?")
    .setDescription("Are you sure you want to close this ticket?\nThis action cannot be undone.")
    .setFooter(button.guild.name)
    .setColor("RED")
    var bu1tton = new MessageButton()
      .setStyle(`red`)
      .setEmoji(``)
      .setLabel(`Proceed anyway`)
      .setID("sure")
    button.reply.send({ component: bu1tton, embed: embed }, true)
  }

在我改成它之后button.reply.send({ component: bu1tton, embed: embed }, true)button.channel.send({ component: bu1tton, embed: embed })它工作得很好,虽然每个人都可以看到。

我明白问题是, true,但我不明白为什么?提前致谢。

标签: javascriptnode.jsdiscorddiscord.jsbots

解决方案


你必须使用ephemeral: true而不是}, true)

这是代码:

button.reply.send({ component: bu1tton, embed: embed, ephemeral: true})

推荐阅读