0

Aim: To message everyone in my discord server but with some sort of cooldown.

Attempt: Code

message.guild.members.cache.forEach(member => {
          setTimeout(function() {
            member.send(argresult).then(console.log(greenBright(`DM'd ${member.user.username}#${member.user.discriminator}`))).catch(() => {
              console.error(yellow(`Reattempting to DM member ${member.user.username}#${member.user.discriminator}`))
            })
          }, 4000);
...

I thought that timing out each member would slow it down but it still kept messaging my members very quickly and not between 4 seconds.

Any help would be appreciated :)

felony123
  • 251
  • 7
  • 19
  • 1
    Does this answer your question? [setTimeout not working inside forEach](https://stackoverflow.com/questions/37977602/settimeout-not-working-inside-foreach) – T. Dirks Feb 05 '21 at 13:05

1 Answers1

1

MassDM Bots are against the Discord ToS and Guildlines due to multiple Reasons.

Nadelvorhang
  • 62
  • 1
  • 7