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

158
Views
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 answers
Answer question

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 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!