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

155
Views
Issue when granting multiple roles on Discord upon a new member joining

I have an issue where my bot removes some of the roles he's supposed to grant after adding them to a user upon joining. My code is super simple and works with a single role just fine:

client.on("guildMemberAdd", member => {

    member.roles.add(['959889840353206342']);
    member.roles.add(['959890212870291456']);
    member.roles.add(['959996598413316127']);
    member.roles.add(['961700593221632070']);
})

However, upon a new member joining, this happens: Discord Audit Log

Any help is greatly appreciated.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Try adding some then lines to that

client.on("guildMemberAdd", async member => {

    member.roles.add('959889840353206342').then( () =>
        member.roles.add('959890212870291456')).then( () =>
        member.roles.add('959996598413316127')).then( () =>
        member.roles.add('961700593221632070'))
})

but the best option would be to do this

client.on("guildMemberAdd", async member => {

    member.roles.add(['959889840353206342', '959890212870291456', '959996598413316127', '961700593221632070'])
})
about 4 years ago · Santiago Gelvez 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!