aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-06-11 07:19:04 +0530
committerGravatar Shivansh-007 <[email protected]>2021-06-11 07:19:04 +0530
commita97f0680e70769e4a59015bf5e791198936a9c7b (patch)
tree6ff8f7340c1893cd9dfac6cd9cc1ba156e588634
parentAdd modpings schedule feature (diff)
(modpings): Cancel the task before scheduling it again
-rw-r--r--bot/exts/moderation/modpings.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bot/exts/moderation/modpings.py b/bot/exts/moderation/modpings.py
index 17afe3b77..2aff2ded2 100644
--- a/bot/exts/moderation/modpings.py
+++ b/bot/exts/moderation/modpings.py
@@ -86,6 +86,9 @@ class ModPings(Cog):
log.trace(f"Removing moderator role to mod with ID {mod.id}")
await mod.remove_roles(self.moderators_role, reason="Moderator schedule time expired.")
+ # Remove the task before scheduling it again
+ self._role_scheduler.cancel(mod.id)
+
# Add the task again
log.trace(f"Adding mod pings schedule task again for mod with ID {mod.id}")
schedule_start += datetime.timedelta(minutes=1)