title: How do you delete the discord bot's most recent message? - Discord.py
body: <p>I tried to make a purge command, here is my code:</p>
  <pre><code>@bot.command(pass_context=True)
  @commands.has_permissions(administrator=True)
  async def purge(ctx, limit: int):
    await ctx.channel.purge(limit=limit)
    await ctx.message.delete()
    await ctx.send(f'Deleted {limit} messages. Done by {ctx.author.mention}.')
    await asyncio.sleep(2)
    await bot.delete.message.most_recent()
  </code></pre>
  <p>but when i try to run the command, it deletes the messages but gives this error when it tries to delete the message:</p>
  <pre><code>Ignoring exception in command purge:
  Traceback (most recent call last):
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py&quot;, line 85, in wrapped
      ret = await coro(*args, **kwargs)
    File &quot;main.py&quot;, line 312, in purge
      await ctx.message.delete()
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/message.py&quot;, line 1023, in delete
      await self._state.http.delete_message(self.channel.id, self.id)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py&quot;, line 250, in request
      raise NotFound(r, data)
  discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py&quot;, line 939, in invoke
      await ctx.command.invoke(ctx)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py&quot;, line 863, in invoke
      await injected(*ctx.args, **ctx.kwargs)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py&quot;, line 94, in wrapped
      raise CommandInvokeError(exc) from exc
  discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10008): Unknown Message
  </code></pre>
  <p>Any help?</p>