from discord.ext import commands

class Moderation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def purge(self, ctx, amount=None):
        try:
            c = None
            if amount != None:
                amount = int(amount)
                c = amount + 1
        except TypeError:
            return await ctx.send("lol what")
        except ValueError:
            return await ctx.send("lol what")

        await ctx.channel.purge(limit=c)
        if amount == None: amount = "all da messages"
        else: amount = f"{amount} message/s"
        
        await ctx.send(f"dun, purged {amount}")
        
def setup(client):
    client.add_cog(Moderation(client))

from discord.ext import commands

class Moderation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def purge(self, ctx, amount=None):
        try:
            c = None
            if amount != None:
                amount = int(amount)
                c = amount + 1
        except TypeError:
            return await ctx.send("lol what")
        except ValueError:
            return await ctx.send("lol what")

        await ctx.channel.purge(limit=c)
        if amount == None: amount = "all da messages"
        else: amount = f"{amount} message/s"
        
        await ctx.send(f"dun, purged {amount}")
        
def setup(client):
    client.add_cog(Moderation(client))
