From 9d2497a1a887d57435e1a2bc46df2311fdd38881 Mon Sep 17 00:00:00 2001 From: Mango0x45 Date: Wed, 29 Jul 2020 11:02:57 +0200 Subject: Autoreject runs from banned players --- cogs/admin.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'cogs/admin.py') diff --git a/cogs/admin.py b/cogs/admin.py index e1ed9bf..9b35be0 100755 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -241,19 +241,33 @@ class Admin(commands.Cog): @commands.check(is_mod) async def blacklistvideo(self, ctx, uri): """Set runs from a specific url to be auto rejected""" - with open('video_blacklist.json', 'w') as f: - self.bot.video_blacklist.append(uri) + with open('runs_blacklist.json', 'w') as f: + self.bot.video_blacklist["videos"].append(uri) json.dump(self.bot.video_blacklist, f, indent=4) await ctx.send(f'Blacklisted runs from `{uri}`') @commands.command() @commands.check(is_mod) - async def video_blacklist(self, ctx): - """Sends a list of blacklisted uris""" + async def blacklistplayer(self, ctx, player): + """Set runs from a specific player to be auto rejected""" + with open('runs_blacklist.json', 'w') as f: + self.bot.video_blacklist["players"].append(uri) + json.dump(self.bot.video_blacklist, f, indent=4) + await ctx.send(f'Blacklisted runs from `{player}`') + + @commands.command() + @commands.check(is_mod) + async def runs_blacklist(self, ctx): + """Sends a list of blacklisted videos and players""" message = '```The following URIs are blacklisted:\n' - for uri in self.bot.video_blacklist: + for uri in self.bot.runs_blacklist["videos"]: message += f'{uri}, ' await ctx.send(f'{message[:-2]}```') + message = '```The following players are blacklisted:\n' + for player in self.bot.runs_blacklist["players"]: + message += f'{player}, ' + await ctx.send(f'{message[:-2]}```') + def setup(bot): bot.add_cog(Admin(bot)) -- cgit v1.2.3