title: How to create a message clear command with the amount of messages specified
body: <pre><code>async def delete(ctx, number):
      numbers = int(number)
      await ctx.send(&quot;Deleting messages......&quot;)
      await discord.Message.delete(numbers)
     
  </code></pre>
  <p>I am new to Discord.py, and I am making a bot that can do basic moderation commands. I was trying to make a clear command that deletes the specified amount of messages, for example <code>:del 10</code> would delete 10 messages (Not including the command, so 11 in total). However I kept getting a <code>discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute '_state'</code> error. I have no idea how to fix this and tried google, can anyone help? At first I had a while loop after the <code>await ctx.send(&quot;Deleting messages.....&quot;)</code>, it went like:</p>
  <pre><code>async def delete(ctx, number):
      numbers = int(number)
      max_number == 0 
      await ctx.send(&quot;Deleting messages......&quot;)
      while max_number &lt;= numbers:
             await discord.Message.delete(numbers)
  </code></pre>
  <p>However this was raising the same error as well, and I was not sure if a while loop was even needed as the amount of messages to delete is specified with the <code>numbers</code> variable.</p>