title: How to solve NameError: name 'client_has_permissions' is not defined in discord.py
body: <p>I am making a clear command to delete messages in a channel; but I got following error:</p>
  <pre><code>@client_has_permissions(manage_messages=True) NameError: name 'client_has_permissions' is not defined
  </code></pre>
  <p>How to resolve this error?</p>
  <p><strong>CODE:</strong></p>
  <pre class="lang-py prettyprint-override"><code>from discord.ext import commands
  import os
  import discord
  
  
  @client.command(name=&quot;clear&quot;, aliases=[&quot;purge&quot;])
  @client_has_permissions(manage_messages=True)
  @has_permissions(manage_messages=True)
  async def clear_messages(self, ctx, limit: optional[int] = 100):
    if 0 &lt; limit &lt;= 100 :
      with ctx.channel.typing():
        await ctx.message.delete()
        deleted = await ctx.channel.delete_messages(limit=limit)
  
        await ctx.send(f&quot;Deleted {len(deleted):,} messages.&quot;, delete_after=5)
    else:
      ctx.send(&quot;The limit provided is not within acceptable bounds.&quot;)
  
  
  @client.event
  async def on_ready():
      print(f'Logged in as: {client.user.name}')
  
  
  my_secret = os.environ['TOKEN']
  if __name__ == '__main__':
      client.run(my_secret)
  </code></pre>