Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda