Skip to content

Instantly share code, notes, and snippets.

@psenger
Created January 10, 2021 05:37
Show Gist options
  • Select an option

  • Save psenger/d14f62da74f2a21045b6ded2bb7911c6 to your computer and use it in GitHub Desktop.

Select an option

Save psenger/d14f62da74f2a21045b6ded2bb7911c6 to your computer and use it in GitHub Desktop.
[Discord Give Role] #Python #Discord
from discord.utils import get
@client.command(pass_context=True)
async def giverole(ctx, member: discord.Member, *, role: discord.Role):
check_role = get(ctx.message.server.roles, name='Board of Executives')
if check_role not in member.roles:
await client.say(f"You don't have the role '{str(role)}'")
else:
await client.add_roles(member, role)
await client.say(f"The role '{str(role)}' has been given to {member.mention}.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment