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

131
Views
Guardando la variable de un mensaje en discord.js

me gusta guardar mi DM enviado a un usuario en una variable local. ¿Cómo puedo hacer esto? Me gustaría reaccionar ante ese mensaje, pero si uso .then() después o antes del bloque .catch() requerido, el registro dice "No se pueden enviar mensajes a este usuario", sin él, puedo enviar el mensaje. .

¡¡Gracias!!

Código:

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

uno es el emoji...

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

0

Si está en una función asíncrona , puede poner el mensaje en una variable como esta:

 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 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!