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

176
Vistas
Print user is displaying user id in discord.js

I would like to list server members on Discord using discord.js library. However, some (mostly inactive) users are displayed in form <@123456789123456789> (their id) instead of @Michal (their clickable name with user profile).

It can be because some members are uncached? I tried fetch all members before printing them, even with force option. But without success.

const executeCommand = async (client, message) => {
    const members = await message.guild.members.fetch({ force: true })

    message.channel.send({ embed: {
        title: 'Members',
        description: members.map(m => `<@${m.id}>`).join(', ')
    } })
}

Also both Presence intent and Server member intent are enabled on my bot. How can I fix it?

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

0

This is unfortunately not possible as the fact that the mentions show up as IDs and not the clickable usernames is actually an issue with the Discord client and not the bot itself but does indeed occur when the users haven't been fetched. If you restart your client, look at a message the person in question has sent, and then return to the message sent by the bot the username will show up and it's fully possible that what appears as just the ID for you shows up properly for someone else. If anything, this is something that has to be fixed by Discord themselves and out of our control as bot developers.

about 4 years ago · Juan Pablo Isaza Denunciar

0

I don't know what causes it, but some mentions start with <@! instead of just <@.

I would recommend changing that map function to members.map(m => m.toString()), as you can see in docs, toString() method returns member's mention string.

https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=toString

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