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

133
Vistas
Saving variable of a message in discord.js

i like to save my sended DM to a user in a local variable. How can I do this? I would like to react on that message, but if I use .then() after or before the required .catch()-block, the log says "Cannot send messages to this user", without it, I can send the message..

Thank you!!

Code:

client.users.cache
  .get(memb.id)
  .send(emb5)
  .catch((msb) => {
    write("Error");
  })
  .then((msg) => {
    msg.react(one);
  });

one is the emoji...

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you are in an async function you can put the message in a variable like this:

const user = await client.users.fetch(mem.id); // Fetching the user
const awaitedMessage = await user.send(emb5); // Send the message to the user
awaitedMessage.react(one); // React the sent message
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