Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

596
Views
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 answers
Answer question

0

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

about 4 years ago · Santiago Trujillo Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!