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

168
Views
I can't understand why my message doesn't send to every user that decided to be notified. It only sends to one

I can't understand why my message doesn't send to every user that decided to be notified. It only sends to one. If there are any documents about quick.db to fix it of course let me know.


Here's the notify.js code


module.exports = {
  name: 'notify',
  description: 'Notify people when a new update is released',
  category: "Notified",
  execute(client, message, args, Discord) {
    if(message.member.user.id === '601364286731714591'){
      const db = require('quick.db')
      let notification = db.get(`notifiedusers_${message.author.id}`);
      if(notification === null) {
        return message.channel.send('Nobody is notified for any updates')
      }
      const content = args.join(" ")
      if(!content) return message.channel.send('What would be the content of the Update Be ?')
      
      const newEmbed = new Discord.MessageEmbed()
        .setColor('#b5b5b5')
        .setTitle('Update')
        .setDescription(`${content}`)
      message.channel.send('Notifying everybody that desiced to be notified')
      try{
      const chx = client.users.cache.get(notification)
      chx.send({embeds: [newEmbed]})
      }finally{
        message.channel.send('Everybody was notified')
      }
    }else{
      return
    }
  }
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

      const chx = client.users.cache.get(notification)
      chx.send({embeds: [newEmbed]})

In this function you can only use 1 id to get the user object of the person, if you have an array of people's ids which you can store using db.push you can then get every person's id and send it to each person

      for (const id of <array_of_id>){
         const chx = client.users.cache.get(id)
         chx.send({embeds: [newEmbed]})
      }

Also, doing too many requests to discord's API will get you ratelimited so give a time to send to each user

      for(const id of <array_of_id>){
         const chx = client.users.cache.get(id)
         chx.send({embeds: [newEmbed]})
         // Wait 3000 milliseconds (3 minutes)
         await new Promise(r => setTimeout(r, 3000));
      }
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!