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

159
Vistas
discord.js edit embed timeout

I made a fun command and I got no errors so far.

Here's the code:

const { MessageEmbed } = require('discord.js')


module.exports = {
    name: "spin",
    description: "spin",
    permissions: ["SEND_MESSAGES"],

    run: async (client, message, args) => {

    if(message.author.bot) return;
  
  let number = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36"];

  let secondEmbed = new MessageEmbed()
  .setTitle("The wheel is spinning...")
  .setColor('#fc8eac')
  .setTimestamp()
  .addField("Spinner", `<@!${message.author.id}>`, true)
  .addField("Result", `  <a:dotload:928216650614968321>`, true)
  .setThumbnail('https://cdn.discordapp.com/emojis/928270805492699177.webp?size=160&quality=lossless')
  .setFooter(`${message.author.tag}`, message.author.displayAvatarURL());

    const m = await message.channel.send({embeds: [secondEmbed] })
    
  let firstEmbed = new MessageEmbed()
  .setTitle("The wheel has stopped spinning!")
  .setColor('#fc8eac')
  .setTimestamp()
  .addField("Spinner", `<@!${message.author.id}>`, true)
  .addField("Result", `${number[Math.floor(Math.random() * number.length)]}`, true)
  .setThumbnail('https://cdn.discordapp.com/emojis/928270805492699177.webp?size=160&quality=lossless')
  .setFooter(`${message.author.tag}`, message.author.displayAvatarURL());

  await m.edit(({embeds: [firstEmbed] }), {timeout: 5000})
}
}

I'm having trouble on this line 'coz the embed gets edited in less than the given time length {timeout: 5000}

await m.edit(({embeds: [firstEmbed] }), {timeout: 5000})

I need help on how to fix this.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm not sure if there is a timeout option for the Message#edit method. At least I can't find it in the documentation.

However, you could use the good old setTimeout method to achieve the same:

setTimeout(() => {
  m.edit({ embeds: [firstEmbed] })
}, 5000)
about 4 years ago · Juan Pablo Isaza 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