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

364
Views
How to send a dm to another person discord.js? (javascript)

I'm making a discord bot and I wrote this code, but it gives an error, user.dm is not a function.

My code:

if(message.content.startsWith('s!modöner')) {
    let mesajöner = args.slice(1).join(' ');
    let userdm = 767387717792563241
    userdm.send(mesajöner);
    message.reply('Quixe Öneriniz Gönderildi.');
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I assume that the userdm variable is a user id, and you want to DM that user. In that case, you would first have to get the user from client.users.cache, then you can send it. An example:

const user = client.users.cache.get('767387717792563241')
user.send(mesajöner)

(Note: In discord, all ids are Strings, so any id you use should be used as a string instead of a number like you have)

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!