Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda