Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda