Why is my discord.py purge cmd not working

Ok so ima trying to add a purge command to my discord.py bot but the all argument isn’t working or something becuase when i type upurge all, it only says it deleted all messages but doesn’t deleted the messages. I’m thinking its due to rate limiting but idk

Here’s the code:

@bot.command(aliases=["prg"])
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount: str):
    role = discord.utils.find(lambda r: r.name == 'God', ctx.message.guild.roles)
    if amount == "all":
      if role in ctx.author.roles or ctx.author.id == 738828785482203189:
        await ctx.message.delete()
        await ctx.channel.purge(limit=None)
        await ctx.send("Cleared all messages!", delete_after=5)
      else: await ctx.reply("you do not have permissions to do that")
    elif amount.isdigit() and int(amount) <= 1000 or role in ctx.author.roles or ctx.author.id == 738828785482203189:
        amount = int(amount)
        if int(amount) > 0:
            await ctx.message.delete()
            await ctx.channel.purge(limit=amount)
            await ctx.send(f"Cleared {amount} messages!", delete_after=5)
        else:
            await ctx.send("Please provide a positive number.")
    else:
        await ctx.send("Invalid argument. Please use 'all' or a valid number, or do not go above the 1000 word max(which only owner can do)")