Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

259
Vistas
Sending Bots Name Not Users Discord

So here is my code

const Discord = require('discord.js');

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [4611] });

let targetChannel = '906686653874176090' //target channel

client.once('ready', () => {
    console.log('Ready! - Made By Woodington');
});  

client.on('messageCreate', gotMessage);

function gotMessage(msg) {
    if (msg.channel.id !== targetChannel) { 
        client.channels.fetch(targetChannel)  
        .then(channel => channel.send(msg.content + `${client.user.tag}`)) 
        .catch(console.error);
    }
}

What it does is forward messages to another channel, with the users Discord tag at the bottom. However, it sends the bots Discord name and not the original senders. Any ideas?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are using the client variable which is your own bot. You need to make use of the msg parameter you received within the event. That's the reason why your bot sends its own tag, because client.user.tag equals YourBot#0000.

To send the author's tag, replace client.user.tag with the following:

msg.author.tag

This will return Author's Username#0000

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda