diff options
Diffstat (limited to 'cogs')
-rwxr-xr-x | cogs/admin.py | 9 | ||||
-rwxr-xr-x | cogs/src.py | 3 | ||||
-rwxr-xr-x | cogs/utils.py | 85 |
3 files changed, 66 insertions, 31 deletions
diff --git a/cogs/admin.py b/cogs/admin.py index 014d4cb..ed7b7cc 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].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}`') @@ -317,7 +320,7 @@ class Admin(commands.Cog): @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' + message = '```The following videos are blacklisted:\n' for uri in self.bot.runs_blacklist["videos"]: message += f'{uri}, ' await ctx.send(f'{message[:-2]}```') diff --git a/cogs/src.py b/cogs/src.py index bab79fb..c179a51 100755 --- a/cogs/src.py +++ b/cogs/src.py @@ -152,7 +152,8 @@ 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].split( + '=')[-1] in self.bot.runs_blacklist["videos"]: runs_to_reject.append( [run, 'Detected as spam by our automatic filter.']) diff --git a/cogs/utils.py b/cogs/utils.py index 2a77653..c4b1317 100755 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -110,15 +110,12 @@ class Utils(commands.Cog): } if ctx.author.id in rigged_findseed: - totalEyes = rigged_findseed[ctx.author.id] + total_eyes = rigged_findseed[ctx.author.id] else: - totalEyes = 0 - for i in range(12): - randomness = randint(1, 10) - if randomness <= 1: - totalEyes += 1 + total_eyes = sum([1 for i in range(12) if randint(1,10) == 1]) + await ctx.send( - f"{discord.utils.escape_mentions(ctx.message.author.display_name)} -> your seed is a {totalEyes} eye" + f"{discord.utils.escape_mentions(ctx.message.author.display_name)} -> your seed is a {total_eyes} eye" ) @findseed.error @@ -222,91 +219,97 @@ class Utils(commands.Cog): async def on_message(self, message): if not message.guild: return - if message.channel.id != int(self.bot.config[str( - message.guild.id)]["fair_channel"]): - return if message.author.bot: return badWords = ["fair", "ⓕⓐⓘⓡ"] count = 0 + year = datetime.date.today().year coolKids = [ [ 'Cameron', self.bot.get_user(468262902969663488), - datetime.date(2020, 10, 8) + datetime.date(year, 10, 8) ], [ 'Indy', self.bot.get_user(274923326890311691), - datetime.date(2020, 9, 10) + datetime.date(year, 9, 10) ], [ 'Kai', self.bot.get_user(199070670221475842), - datetime.date(2020, 11, 20) + datetime.date(year, 11, 20) ], [ 'Luca', self.bot.get_user(99457716614885376), - datetime.date(2020, 11, 5) + datetime.date(year, 11, 5) ], [ 'Max', self.bot.get_user(543958509243596800), - datetime.date(2020, 11, 10) + datetime.date(year, 11, 10) ], [ 'Mistaken', self.bot.get_user(264121998173536256), - datetime.date(2020, 7, 6) + datetime.date(year, 7, 6) ], [ - 'Murray', + 'Jake', self.bot.get_user(400344183333847060), datetime.date(2020, 11, 10) ], [ 'Nevaeh', self.bot.get_user(738279874749530172), - datetime.date(2020, 11, 5) + datetime.date(year, 11, 5) ], # idk if she goes by her irl name but I'm sticking with it for the sake of uniformity # also idk how to pronounce prakxo + + # EDIT: Seems like real names are the standard now lol + # its just a name, aliases are stupid [ 'Samantha', self.bot.get_user(226312219787264000), - datetime.date(2020, 6, 24) + datetime.date(year, 6, 24) ], [ 'Scott', self.bot.get_user(223937483774230528), - datetime.date(2020, 6, 23) + datetime.date(year, 6, 23) ], [ 'Ben', self.bot.get_user(329538915805691905), - datetime.date(2020, 6, 24) + datetime.date(year, 6, 24) ], [ 'Thomas', self.bot.get_user(280428276810383370), - datetime.date(2020, 9, 29) + datetime.date(year, 9, 29) ], [ - 'Samantha', # This one is Zyemlus + 'Samantha', # This one is Zyemlus self.bot.get_user(536071288859656193), - datetime.date(2020, 8, 23) + datetime.date(year, 8, 23) ], [ 'Landen', self.bot.get_user(654025117025828885), - datetime.date(2020, 8, 24) + datetime.date(year, 8, 24) ], [ 'Oceanlight', self.bot.get_user(615658069132836865), - datetime.date(2020, 4, 9) + datetime.date(year, 4, 9) + ], + [ + 'Shadowfi', + self.bot.get_user(586664256217415681), + datetime.date(year, 11, 14) ] ] @@ -315,7 +318,7 @@ class Utils(commands.Cog): try: for i in range(self.tries): await coolKid[1].send( - f'Happy Birthday {coolKid[0]}! You\'re a boomer now! :mango:' + f'Happy Birthday {coolKid[0]}! You\'re a boomer now! <:mangopog:730683234039365722>' ) self.tries = 1 except: @@ -382,5 +385,33 @@ class Utils(commands.Cog): output = ", ".join([*commands]) await ctx.send(f"```List of custom commands:\n{output}```") + @commands.command() + async def retime(self, ctx, start_sec, end_sec, frames=0, framerate=30): + """Retimes a run using the start/end timestamps, leftover frames, and framerate""" + if start_sec.count(':') == 2: + start_sec = sum( + x * int(t) + for x, t in zip([3600, 60, 1], start_sec.split(":"))) + elif start_sec.count(':') == 1: + start_sec = sum(x * int(t) + for x, t in zip([60, 1], start_sec.split(":"))) + else: + start_sec = int(start_sec) + + if end_sec.count(':') == 2: + end_sec = sum(x * int(t) + for x, t in zip([3600, 60, 1], end_sec.split(":"))) + elif end_sec.count(':') == 1: + end_sec = sum(x * int(t) + for x, t in zip([60, 1], end_sec.split(":"))) + else: + end_sec = int(end_sec) + + await ctx.send( + str( + timedelta(seconds=end_sec - start_sec + + round((int(frames) / int(framerate)), 3))).replace('000', '')) + + def setup(bot): bot.add_cog(Utils(bot)) |