From 5b6500aa1630d774c13d40ef317b8b5e4f07d6da Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Sun, 13 Jun 2021 12:39:25 +0530 Subject: (modpings): Add subcommand to delete your modpings schedule --- bot/exts/moderation/modpings.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bot/exts/moderation/modpings.py b/bot/exts/moderation/modpings.py index c0e742699..9b7843e20 100644 --- a/bot/exts/moderation/modpings.py +++ b/bot/exts/moderation/modpings.py @@ -183,7 +183,11 @@ class ModPings(Cog): await ctx.send(f"{Emojis.check_mark} Moderators role has been re-applied.") - @modpings_group.command(name='schedule') + @modpings_group.group( + name='schedule', + aliases=('s',), + invoke_without_command=True + ) @has_any_role(*MODERATION_ROLES) async def schedule_modpings(self, ctx: Context, start: str, end: str) -> None: """Schedule modpings role to be added at and removed at everyday at UTC time!""" @@ -215,6 +219,14 @@ class ModPings(Cog): f"{start: %H:%M} to {end: %H:%M} UTC Timing!" ) + @schedule_modpings.command(name='delete', aliases=('del', 'd')) + async def modpings_schedule_delete(self, ctx: Context): + """Delete your modpings schedule.""" + self._modpings_scheduler.cancel(ctx.author.id) + await self.modpings_schedule.delete(ctx.author.id) + await ctx.send(f"{Emojis.ok_hand} {ctx.author.mention} Deleted your modpings schedule!") + + def cog_unload(self) -> None: """Cancel role tasks when the cog unloads.""" log.trace("Cog unload: canceling role tasks.") -- cgit v1.2.3