Adding kick/ban/unban/purge

pull/8/head
sgoudham 4 years ago
parent 4c0ccb4317
commit abaadfaf56

@ -52,14 +52,18 @@ class Moderation(commands.Cog):
@has_guild_permissions(manage_messages=True) @has_guild_permissions(manage_messages=True)
async def purge(self, ctx, amount=100): async def purge(self, ctx, amount=100):
"""Purge Messages from Channel""" """Purge Messages from Channel"""
channel = ctx.message.channel
messages = []
async for message in channel.history(limit=amount): if amount > 100:
messages.append(message) await ctx.send("Sorry! You can only purge up to **100** messages at a time!")
else:
channel = ctx.message.channel
messages = []
await channel.delete_messages(messages) async for message in channel.history(limit=amount):
await ctx.send('Messages deleted.') messages.append(message)
await channel.delete_messages(messages)
await ctx.send(f"{ctx.author.mention} {amount} messages deleted!")
def setup(bot): def setup(bot):

Loading…
Cancel
Save