aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2021-04-17 01:24:17 +0300
committerGravatar mbaruh <[email protected]>2021-04-17 01:24:17 +0300
commit5506fb74f90831e686f4636595f62e4bcc72a703 (patch)
treee4199dd29322fe36bd062ad2284beb9785764ba0
parentAssume a scheduled task exists for `duty on` (diff)
Improve documentation
-rw-r--r--bot/exts/moderation/duty.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/moderation/duty.py b/bot/exts/moderation/duty.py
index 8d0c96363..eab0fd99f 100644
--- a/bot/exts/moderation/duty.py
+++ b/bot/exts/moderation/duty.py
@@ -94,11 +94,12 @@ class Duty(Cog):
mod = ctx.author
- until_date = duration.replace(microsecond=0).isoformat()
+ until_date = duration.replace(microsecond=0).isoformat() # Looks noisy with microseconds.
await mod.remove_roles(self.moderators_role, reason=f"Entered off-duty period until {until_date}.")
await self.off_duty_mods.set(mod.id, duration.isoformat())
+ # Allow rescheduling the task without cancelling it separately via the `on` command.
if mod.id in self._role_scheduler:
self._role_scheduler.cancel(mod.id)
self._role_scheduler.schedule_at(duration, mod.id, self.reapply_role(mod))
@@ -118,6 +119,7 @@ class Duty(Cog):
await self.off_duty_mods.delete(mod.id)
+ # We assume the task exists. Lack of it may indicate a bug.
self._role_scheduler.cancel(mod.id)
await ctx.send(f"{Emojis.check_mark} Moderators role has been re-applied.")