#How to tell Discord.js that the interaction executed succesfully?

4 messages · Page 1 of 1 (latest)

tall finch
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

heady timber
#
const { EmbedBuilder } = require("discord.js");

module.exports = {
  async execute(Bot, interaction) {

    const oldEmbed = interaction.message.embeds[0];

    let acceptValue = parseInt(oldEmbed.fields.find(x => x.name == "Accept").value);
    let refuseValue = parseInt(oldEmbed.fields.find(x => x.name == "Refuse").value);

    acceptValue++;

    const total = acceptValue + refuseValue;

    oldEmbed.fields.find(x => x.name == "Accept").value = acceptValue.toString();
    oldEmbed.fields.find(x => x.name == "Refuse").value = refuseValue.toString();
    oldEmbed.fields.find(x => x.name == "Percentage").value = ((acceptValue / total) * 100).toFixed(2) + "%";

    const embed = EmbedBuilder.from(oldEmbed);

    console.dir(interaction.message);

    interaction.message.edit({embeds: [embed], ephemeral: true});

  }
};
arctic hinge
#

Reply to the interaction

#

You can use interaction.update instead of message.edit