diff options
author | 2019-10-03 12:25:17 -0700 | |
---|---|---|
committer | 2019-10-03 12:25:17 -0700 | |
commit | efd8a30fea6f04d0660c6bfa0ea499774a690a73 (patch) | |
tree | ee7c2815c94df6229ba371816432a051b8267b6f | |
parent | Make warns, notes, and kicks always inactive (diff) |
Fix rescheduling of infractions when cog is reloaded
-rw-r--r-- | bot/cogs/moderation/infractions.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index ce9c33bbc..66f72b1e0 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -30,18 +30,20 @@ class Infractions(Scheduler, commands.Cog): """Server moderation tools.""" def __init__(self, bot: commands.Bot): + super().__init__() + self.bot = bot self.category = "Moderation" self._muted_role = discord.Object(constants.Roles.muted) - super().__init__() + + self.bot.loop.create_task(self.reschedule_infractions()) @property def mod_log(self) -> ModLog: """Get currently loaded ModLog cog instance.""" return self.bot.get_cog("ModLog") - @commands.Cog.listener() - async def on_ready(self) -> None: + async def reschedule_infractions(self) -> None: """Schedule expiration for previous infractions.""" infractions = await self.bot.api_client.get( 'bot/infractions', |