Adding roles in a different guild #5903
Unanswered
aayushkdev
asked this question in
Q&A
Replies: 2 comments 8 replies
-
Roles are server-specific. I'm assuming you mean you want to clone a role from guild A to guild B. To do this, you just create a role in the guild you care about with the same attributes, for example: first_guild_id = 123 # The guild ID of the guild with the role you want to clone
first_guild = bot.get_guild(first_guild_id)
second_guild_id = 123 # The guild ID of the guild you want to clone the role to
second_guild = bot.get_guild(second_guild_id)
role_id = 123 # The role ID of the role you want to clone
role = first_guild.get_role(role_id)
fields = {
'name': role.name,
'permissions': role.permissions,
'colour': role.colour,
'hoist': role.hoist,
'mentionable': role.mentionable,
}
await second_guild.create_role(**fields, reason=f'Cloning role from {first_guild.name}') Note that IDs are integers. If it's not found then it'll return |
Beta Was this translation helpful? Give feedback.
0 replies
-
no see there are two servers one is staff and one is the main so if I run the command in one server it adds the role in both servers to a specific member (the roles are already created) |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to add a role in one server and the role should be added in the other server is there anyway I can do it
Beta Was this translation helpful? Give feedback.
All reactions