Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

439
Views
la interacción falló sin ningún motivo discord.js v13

Estaba haciendo un simple comando de lanzamiento de monedas en mi bot de discordia. Está funcionando pero genera un evento de "Error de interacción" sin motivo. Edita la inserción y cambia las cosas que debería cambiar. y borra el mensaje sin ningún problema.

Mi código:

 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]}) })

Nota: No recibo ningún error. Estoy usando discord.js v13 y node.js v16

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Todavía tiene que responder a la interacción usando el método Interaction#reply(). Esto es para reconocer a Discord que usted manejó la interacción. Algo como interaction.reply("success") probablemente hará el trabajo

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!