I\'m making a Discord bot but just ran into a problem.
I want to modify a role. A specific role. I know how to do that with edit_role
, but I need to get
You can simply use Guild.get_role(role_id)
to get the role if you have the id.
role_id = 2134532534
role = my_server.get_role(role_id)
You can use discord.utils.get to loop through Guild.roles
and get the one you're looking for:
from discord.utils import get
role_id = 123
role = get(guild.roles, id=role_id)