title: Discord.py how to make a command work for certain roles?
body: <p>I have this code which if someone has a role &quot;Server Developer&quot; it is suppose to run the command which is to give someone the role &quot;Jail&quot; for the determent amount n the command but it doesn't work and gives no errors.</p>
  <pre><code>import discord
  from discord.ext import commands
  import ctx
  import re
  import time
  from time import sleep
  import asyncio
  
  PREFIX = &quot;$&quot;
  bot = commands.Bot(command_prefix=PREFIX, description=&quot;Hi&quot;)
  
  @commands.has_role(&quot;Server Developer&quot;)
  @bot.command()
  async def court(ctx, user_mentioned: discord.Member, time: int):
      user_id = message.mentions[0].id
      user = message.mentions[0]
      role = discord.utils.get(message.guild.roles, name=&quot;Jail&quot;)
      await user_mentioned.add_roles(role)
      await ctx.send(
          f&quot;sending &lt;@{user_id}&gt; to court!&quot;
      )
      await asyncio.sleep(time)
      await user_mentioned.remove_roles(role)
  
  bot.run(TOKNE_GOES_HERE)
  </code></pre>