Skip to content
Advertisement

How to give one role to multiple discord user using the user id

I want to give one role named helper to multiple users whose user id’s are in a list called user_id

Here is my code:

JavaScript

This is the error I got:

JavaScript

Advertisement

Answer

I started by renaming some of the variables for clarity. I then got the member object using the user_ids and then added the role. Finally, I moved the await ctx.send('roles have been given') outside of the for loop so that it’ll only send a single message.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement