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

597
Vistas
How do you give a user a role by role ID in Discord.JS V13 (latest)

I'm trying to make a verification bot for my new Discord server, but I need to know how to assign roles in Discord.JS 13 latest.

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

It's GuildMember.roles.add(roleOrRoles, [optionalReason]). In the discord.js docs: docs: -addrole.

about 4 years ago · Santiago Trujillo Denunciar

0

You can do this something like same thing with getting member.id.

const member = message.mentions.members.first() || message.guild.members.cache.get(args[0])

You can create the code similar to this.

const role = message.mentions.roles.first() || message.guild.roles.cache.get(args[0])

Now you can adjust your code file:

const member = message.mentions.members.first() || message.guild.members.cache.get(args[0])
const role = message.mentions.roles.first() || message.guild.roles.cache.get(args[1])

member.roles.add(role) //To add the mentioned or given role id the the member.

You can see the image below, the format is args[0] for member and args[1] is for role. Try to experiment your code for this time!

                                       Example add role

about 4 years ago · Santiago Trujillo 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