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

140
Views
message.author.id returning bot id

I am trying to make a modmail system and whenever it creates a ticket, it logs your id in quick.db (for sending messages from the dm to the support ticket), Although, whenever I try to do that, it returns the ID for the bot.

Here is the code I use

client.on('message', message => {
  if(db.has(`ticket-${message.author.id}`)){
    console.log(message.author.id)
    if(message.channel.type == "dm"){
      const channel = client.channels.cache.find(c => c.name === `ticket-${message.author.id}` && c.type === 'text');
      channel.send(message.content)
    }
  }
})

Whenever I open a ticket and send something it sends the bots id in the console, not my own. I am using version 12 for this project

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

0

channel.send(message.content) emits the message event just like any other user message. To ignore bot messages add

if (message.author.bot) return; 

To the top of your message listener.

client.on('message', message => {
   if (message.author.bot) return;
   // Your Code ...
})
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!