I have tried and researched a lot of times but still could not find it. I want to make a command that deletes a selected role in the server. Here is what I came up with (Don't currently care about permissions):

```
@bot.command(pass_context=True)
async def delrole(ctx, role: discord.Role):
    await bot.delete_role(role)
    await bot.say("The role {} has been deleted!".format(role.name))

```

If you could help that would be awesome. I used role: [discord.Role](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role) and [delete\_role()](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.delete_role). Thank you for reading. If you have a solution, feel free to comment it.

**NOTICE:** This post was for the old version of `discord.py` and will no longer work. If you are looking for an equivalent solution for the rewrite (v1) version of `discord.py`, you can use the following code:

```py
@bot.command(pass_context=True)
async def delrole(ctx, *, role_name):
  role = discord.utils.get(ctx.message.guild.roles, name=role_name)
  if role:
    try:
      await role.delete()
      await ctx.send("The role {} has been deleted!".format(role.name))
    except discord.Forbidden:
      await ctx.send("Missing Permissions to delete this role!")
  else:
    await ctx.send("The role doesn't exist!")

```