diff options
| author | 2021-12-10 13:21:59 +0530 | |
|---|---|---|
| committer | 2021-12-10 13:21:59 +0530 | |
| commit | a0c742e70688645a31bed762fffb033ebe57ce94 (patch) | |
| tree | 27ea910fbe622f1c2f4da4f574c9db650dea5c48 | |
| parent | Make the help message more verbose (diff) | |
Don't add modpings role back (after manual off) if schedule over
| -rw-r--r-- | bot/exts/moderation/modpings.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bot/exts/moderation/modpings.py b/bot/exts/moderation/modpings.py index 98ceee135..a205d9179 100644 --- a/bot/exts/moderation/modpings.py +++ b/bot/exts/moderation/modpings.py @@ -124,6 +124,15 @@ class ModPings(Cog): async def reapply_role(self, mod: Member) -> None: """Reapply the moderator's role to the given moderator.""" + mod_schedule = self.modpings_schedule.get(mod.id) + if ( + mod_schedule + and datetime.datetime.utcnow() + < datetime.datetime.utcfromtimestamp(mod_schedule.split("|")[0]) + ): + log.trace(f"Skipping re-applying role to mod with ID {mod.id} as their modpings schedule is over.") + return + log.trace(f"Re-applying role to mod with ID {mod.id}.") await mod.add_roles(self.moderators_role, reason="Pings off period expired.") await self.pings_off_mods.delete(mod.id) |