Browse Source

added warn purge command to help clear the warnings list when it gets too big.

tags/v1.7.1
Roxie Gibson 6 years ago
parent
commit
c21c49aa1a
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      roxbot/cogs/admin.py

+ 14
- 0
roxbot/cogs/admin.py View File

@@ -205,6 +205,20 @@ class Admin():
except KeyError:
return await ctx.send("Could not find user in warning list.")

@commands.bot_has_permissions(ban_members=True)
@warn.command()
async def purge(self, ctx, dry_run=0):
"""Purges banned users from the warn list. Add a 1 at the end to do a dry run."""
settings = gs.get(ctx.guild)
count = 0
for ban in await ctx.guild.bans():
for user in settings.warnings:
if user == ban.user.id:
if not dry_run:
settings.warnings.pop(user)
count += 1
return await ctx.send("Purged {} banned users from the warn list.".format(count))

@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(kick_members=True)
@bot.command()

Loading…
Cancel
Save