diff options
author | Mango0x45 <thomasvoss@live.com> | 2020-08-23 12:14:25 +0000 |
---|---|---|
committer | Mango0x45 <thomasvoss@live.com> | 2020-08-23 12:14:25 +0000 |
commit | 2a0c44c7da643a4b27b3bbd5327e125658d7488a (patch) | |
tree | ea3794bab6e927c94b0479fe8129daba3479a00c | |
parent | 2a4b88888888b9155f20e28c1b19230b80981d0d (diff) | |
download | steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar.gz steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar.bz2 steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar.lz steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar.xz steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.tar.zst steve-bot-2a0c44c7da643a4b27b3bbd5327e125658d7488a.zip |
Blacklisted videos are now stored by ID instead of URI
-rwxr-xr-x | cogs/admin.py | 7 | ||||
-rwxr-xr-x | cogs/src.py | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cogs/admin.py b/cogs/admin.py index 014d4cb..c023cd4 100755 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -292,15 +292,18 @@ class Admin(commands.Cog): async def delvar(self, ctx, key): """Deletes a config variable, be careful""" with open('config.json', 'w') as f: - await ctx.send(f"Removed {self.bot.config[str(ctx.message.guild.id)].pop(key)}") + await ctx.send( + f"Removed {self.bot.config[str(ctx.message.guild.id)].pop(key)}" + ) json.dump(self.bot.config, f, indent=4) @commands.command() @commands.check(is_mod) async def blacklistvideo(self, ctx, uri): """Set runs from a specific url to be auto rejected""" + video_id = uri.split('/')[-1] with open('runs_blacklist.json', 'w') as f: - self.bot.runs_blacklist["videos"].append(uri) + self.bot.runs_blacklist["videos"].append(video_id) json.dump(self.bot.runs_blacklist, f, indent=4) await ctx.send(f'Blacklisted runs from `{uri}`') diff --git a/cogs/src.py b/cogs/src.py index 7a8fd9e..2fa57d4 100755 --- a/cogs/src.py +++ b/cogs/src.py @@ -152,7 +152,7 @@ async def pendingRuns(self, ctx): for run in pending_runs: # Reject run if video is blacklisted - if run.video in self.bot.runs_blacklist["videos"]: + if run.video.split('/')[-1] in self.bot.runs_blacklist["videos"]: runs_to_reject.append( [run, 'Detected as spam by our automatic filter.']) |