#Private Message all members in server (D.JS 14)

6 messages · Page 1 of 1 (latest)

light idol
#

i'm trying to make an annoucement system, and make it private message all members of the server when annoucement command activated
codeblock:

const ANNC_TYPE_NOTIFY = "Notify"
      const ANNC_TYPE_EVENT = "Event"
      const ANNC_TYPE_EMERGENCY = "Emergency announcement"

      client_emilie.guild.members.fetch().then(async (members) => {
        members.forEach(async (member) => {
            member.send('hello world | ' + ANNC_TYPE_NOTIFY)
        });
    });```
OS: Arch Linux x86_64
discord.js library version: latest stable from npm
shadow marlinBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
jolly pumice
#

that's a great way to get your bot banned. Use @everyone mention to send an announcement or simply an announcement channel.

plush templeBOT
#

Mass DMing users is not allowed as per developer ToS, considered spam and can get you and your bot banned.

  • Mention @everyone to inform all your users at once instead
  • Discord Developer Terms of Service: learn more | FAQ summary
light idol
#

so the issue is solved