diff options
| -rw-r--r-- | bot/cogs/moderation/infractions.py | 2 | ||||
| -rw-r--r-- | bot/cogs/moderation/scheduler.py | 8 | ||||
| -rw-r--r-- | bot/cogs/moderation/superstarify.py | 5 | 
3 files changed, 9 insertions, 6 deletions
| diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index 7e8d58144..0e29b02f7 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -26,7 +26,7 @@ class Infractions(InfractionScheduler, commands.Cog):      category_description = "Server moderation tools."      def __init__(self, bot: commands.Bot): -        super().__init__(bot) +        super().__init__(bot, supported_infractions={"ban", "kick", "mute", "note", "warning"})          self.category = "Moderation"          self._muted_role = discord.Object(constants.Roles.muted) diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py index fe8e43fbe..74ff62981 100644 --- a/bot/cogs/moderation/scheduler.py +++ b/bot/cogs/moderation/scheduler.py @@ -24,18 +24,18 @@ log = logging.getLogger(__name__)  class InfractionScheduler(Scheduler):      """Handles the application, pardoning, and expiration of infractions.""" -    def __init__(self, bot: Bot): +    def __init__(self, bot: Bot, supported_infractions: t.Container[str]):          super().__init__()          self.bot = bot -        self.bot.loop.create_task(self.reschedule_infractions()) +        self.bot.loop.create_task(self.reschedule_infractions(supported_infractions))      @property      def mod_log(self) -> ModLog:          """Get the currently loaded ModLog cog instance."""          return self.bot.get_cog("ModLog") -    async def reschedule_infractions(self) -> None: +    async def reschedule_infractions(self, supported_infractions: t.Container[str]) -> None:          """Schedule expiration for previous infractions."""          await self.bot.wait_until_ready() @@ -44,7 +44,7 @@ class InfractionScheduler(Scheduler):              params={'active': 'true'}          )          for infraction in infractions: -            if infraction["expires_at"] is not None: +            if infraction["expires_at"] is not None and infraction["type"] in supported_infractions:                  self.schedule_task(self.bot.loop, infraction["id"], infraction)      async def reapply_infraction( diff --git a/bot/cogs/moderation/superstarify.py b/bot/cogs/moderation/superstarify.py index 3200087ae..a534ec762 100644 --- a/bot/cogs/moderation/superstarify.py +++ b/bot/cogs/moderation/superstarify.py @@ -7,7 +7,7 @@ from pathlib import Path  from discord import Colour, Embed, Member  from discord.errors import Forbidden -from discord.ext.commands import Cog, Context, command +from discord.ext.commands import Bot, Cog, Context, command  from bot import constants  from bot.utils.checks import with_role_check @@ -25,6 +25,9 @@ with Path("bot/resources/stars.json").open(encoding="utf-8") as stars_file:  class Superstarify(InfractionScheduler, Cog):      """A set of commands to moderate terrible nicknames.""" +    def __init__(self, bot: Bot): +        super().__init__(bot, supported_infractions={"superstar"}) +      @Cog.listener()      async def on_member_update(self, before: Member, after: Member) -> None:          """ | 
