Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

442
Vistas
interaction failed without any reason discord.js v13

I was making a simple coinflip command in my discord bot. It is working but makes an "Interaction Failed" event without reason. It edits the embed and changes things it should change. and it deletes the message without any problem.

My Code:

const randomResult = Math.floor(Math.random() * 2) == 0 ? "Heads" : "Tails";

const embed = new MessageEmbed()
.setTitle("Coin Flip")
.setColor("YELLOW")
.setDescription(` > ${randomResult}`)
.setFooter({
text: `Requested by ${message.author.username}`,
iconURL: message.author.displayAvatarURL(),
});

const row = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("again")
.setLabel("Throw Again")
.setEmoji("🔁")
.setStyle("PRIMARY"),

new MessageButton()
.setCustomId("delete")
.setLabel("Delete")
.setEmoji("♻")
.setStyle("DANGER")
);
message.channel.send({ embeds: [embed], components: [row] }).then(msg => {
global.msg = msg;
})
const iFilter = (i) => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({
filter: iFilter,
time: 30000,
});
collector.on("collect", async (i) => {
if (i.customId === "again") {
const randomResult =
Math.floor(Math.random() * 2) == 0 ? "Heads" : "Tails";
const newEmbed = new MessageEmbed()
.setTitle("Coin Flip")
.setColor("YELLOW")
.setDescription(` > ${randomResult}`)
.setFooter({
text: `Requested by ${message.author.username}`,
iconURL: message.author.displayAvatarURL(),
});
const row = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("again")
.setLabel("Throw Again")
.setEmoji("🔁")
.setStyle("PRIMARY"),
new MessageButton()
.setCustomId("delete")
.setLabel("Delete")
.setEmoji("♻")
.setStyle("DANGER")
);
msg.edit({ embeds: [newEmbed], components: [row] });
}
if (i.customId === "delete") {
msg.delete();
}
})
collector.on("end", async (i) => {
const newEmbed2 = new MessageEmbed()
.setTitle("Coin Flip")
.setColor("YELLOW")
.setDescription(` > ${randomResult}`)
.setFooter({
text: `Requested by ${message.author.username}`,
iconURL: message.author.displayAvatarURL(),
});
const row = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("ended")
.setLabel("Coin Flip Ended")
.setEmoji("❎")
.setStyle("DANGER")
.setDisabled(true),
);
msg.edit({embed: [newEmbed2], components: [row]})
})

Note: I am not getting any errors. I am using discord.js v13 and node.js v16

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You still have to reply to the interaction using Interaction#reply() method. This is to acknowledge to discord that you handled the interaction. Something like interaction.reply("success") will probably do the job

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda