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

202
Views
Quiero que mi bot envíe un mensaje directo a un usuario SOLO si el mensaje directo del usuario

No estoy haciendo un comando, solo quiero enviar un mensaje cada vez que un usuario envíe un dm al bot. Cualquier mensaje. aquí está el código que escribí pero es específico para un comando-

 client.on("messageCreate", (message) => { if (message.content === "hi") { message.member.send("Hello") } })
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para ejecutar un fragmento de código cuando un usuario envía un DM a un bot, todo lo que tiene que hacer es agregar la intención DIRECT_MESSAGES a su cliente. Luego, puede modificar su código actual para verificar si el mensaje enviado fue en un DM y luego ejecutar un código:

 client.on("messageCreate", (message) => { if (message.channel.type === 'DM') { // Execute something } })
about 4 years ago · Santiago Trujillo 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!