I'm trying to delete all roles in my discord server, but it takes a huge amount of time. So I decided to do this task with discord.py bot, but I'm getting this error:
discord.errors.HTTPException: 400 Bad Request (error code: 50028): Invalid Role
Here's my code:
@client.command()
async def delroles(ctx):
for role in ctx.guild.roles:
await role.delete()