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

451
Vistas
Ping a role in an auto message from my custom Discord bot

I'm facing an issue concerning my Discord bot. I made an automatic answer that pings the user when he gets a role. Everything works fine, the user gets pinged and the embed appears as planed.

I would like to add a role ping to this message. The problem with the following code is that the role won't get pinged (just the role, the username and the embed work perfectly). It just shows the ID of the role exactly like in the code.

Could someone tell me if there's an error in this line:

channel.send({content :`**${oldMember.user} something is written here** <@&11111111111111>, something is written here too`, embeds :\[embed\]});

(11111111111 = role ID)

I expect my bot to ping the role every time this message is sent. I tried the mentioned code line and this one as well, but this shows "@deleted-role":

channel.send({content :`**${oldMember.user} something is written here** <@&${1111111111111}, something is written here too`, embeds :\[embed\]});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After some researching, I found a workable code:

const role = message.guild.roles.cache.filter(role => role.id === "11111111111111");

channel.send({content :`**${oldMember.user} something is written here** ${role}, something is written here too`, embeds :\[embed\]});

https://discord.js.org/#/docs/discord.js/stable/class/RoleManager the Discord.js documentations are really helpful as a resource.

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