discord.py remove roles from Discord bot

49 Views Asked by At

I want remove roles for user on command

 @bot.command()
 async def remove(ctx):
 guild = bot.get_guild('server_id') 
 role = discord.utils.get(ctx.guild.roles, id='role_id')
 await ctx.author.remove_roles(role)

But role not remove from user.

1

There are 1 best solutions below

0
boez On

Your code is not indented right:

@bot.command()
async def remove(ctx):
 role = discord.utils.get(ctx.guild.roles, id='role_id')
 await ctx.author.remove_roles(role)