Jda: Add role to a user

Created on 3 Jan 2018  路  3Comments  路  Source: DV8FromTheWorld/JDA

Hello,

I searched on Google how to add a role by its name. Can you help me?
I tried this:
event.getGuild().getController().addRolesToMember(event.getMember(), event.getJDA().getRolesByName("MYGROUP", true)).complete();
But it return me an error. (https://pastebin.com/VmcAix3m)
It's hard for me to understand how to add a role to a member.

P.S.: Sorry for my English

Most helpful comment

Can't modify a role with higher or equal highest role than yourself!
Role hierarchy my friend. The highest role on the bot is below the one it is trying to assign.

All 3 comments

Can't modify a role with higher or equal highest role than yourself!
Role hierarchy my friend. The highest role on the bot is below the one it is trying to assign.

Okay thanks, sorry for this issue. xD

@liovy is this resolved then? Gonna close the issue because it looks that way.
For future help like this (basic questions), it would be better if you would ask in our guild instead (linked in the readme)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Andre601 picture Andre601  路  6Comments

napstr picture napstr  路  3Comments

Bungeefan picture Bungeefan  路  6Comments

MinnDevelopment picture MinnDevelopment  路  5Comments

xeu100 picture xeu100  路  5Comments