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

162
Views
No obtengo Dms console.log en el complemento discord.js npmjs

El console.log() en el evento "messageCreate" no se activa cuando se envía un DM.

 const Client = new Discord.Client({ intents: [ "GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES" ] }) Client.on('messageCreate', (msg) => { msgArray = msg.content.toLowerCase().split(' ') if (msgArray[0] == "/botmsg"){ Client.users.fetch(msgArray[1], false).then((user) => { user.send(msgArray[2]); }); } else { console.log(msg.content); } }) Client.login('token hidden')

Mi objetivo es registrar el mensaje cuando se recibe un DM, ¿cómo puedo hacer esto?

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

0

Con discord.js v13, debe habilitar el CHANNEL parcial, por lo que su Cliente debe estar

 const Client = new Discord.Client({ intents: [ "GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES" ], partials: [ "CHANNEL" ] })
about 4 years ago · Juan Pablo Isaza Report

0

Debe poner su función console.log en la parte "verdadera" del código.

 if (msgArray[0] == "/botmsg"){ Client.users.fetch(msgArray[1], false).then((user) => { user.send(msgArray[2]); }); console.log(msg.content); } else { console.log(msg.content); }
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!