diff options
author | 2021-06-11 07:54:09 +0530 | |
---|---|---|
committer | 2021-06-11 07:54:09 +0530 | |
commit | f8fa9ba626a404aa825b3554ba136cf4196bd87c (patch) | |
tree | 0dcc6954f9caf84797746b0cc55b1f52e60b01ad | |
parent | (modpings): Use separate scheduler for modpings schedule (diff) |
(modpings): Make flake8 happy!
-rw-r--r-- | bot/exts/moderation/modpings.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bot/exts/moderation/modpings.py b/bot/exts/moderation/modpings.py index f5ce9160d..1154bce9c 100644 --- a/bot/exts/moderation/modpings.py +++ b/bot/exts/moderation/modpings.py @@ -16,6 +16,7 @@ log = logging.getLogger(__name__) MINIMUM_WORK_LIMIT = 16 + class ModPings(Cog): """Commands for a moderator to turn moderator pings on and off.""" @@ -24,7 +25,6 @@ class ModPings(Cog): # The cache's values are the times when the role should be re-applied to them, stored in ISO format. pings_off_mods = RedisCache() - # RedisCache[discord.Member.id, 'start timestamp|total worktime in seconds'] # The cache's keys are mod's ID # The cache's values are their pings on schedule timestamp and the total seconds (work time) until pings off @@ -186,13 +186,17 @@ class ModPings(Cog): @modpings_group.command(name='schedule') @has_any_role(*MODERATION_ROLES) async def schedule_modpings(self, ctx: Context, start: str, end: str) -> None: + """Schedule modpings role to be added at <start> and removed at <end> everyday at UTC time!""" start, end = parse(start), parse(end) if end < start: end += datetime.timedelta(days=1) if (end - start) < datetime.timedelta(hours=MINIMUM_WORK_LIMIT): - await ctx.send(f":x: {ctx.author.mention} You need to have the role on for a minimum of {MINIMUM_WORK_LIMIT} hours!") + await ctx.send( + f":x: {ctx.author.mention} You need to have the role on for " + f"a minimum of {MINIMUM_WORK_LIMIT} hours!" + ) return start, end = start.replace(tzinfo=None), end.replace(tzinfo=None) @@ -207,7 +211,8 @@ class ModPings(Cog): ) await ctx.send( - f"{Emojis.ok_hand} {ctx.author.mention} Scheduled mod pings from {start: %I:%M%p} to {end: %I:%M%p} UTC Timing!" + f"{Emojis.ok_hand} {ctx.author.mention} Scheduled mod pings from " + f"{start: %I:%M%p} to {end: %I:%M%p} UTC Timing!" ) def cog_unload(self) -> None: |