diff options
author | 2023-03-20 15:19:15 +0200 | |
---|---|---|
committer | 2023-03-20 15:19:15 +0200 | |
commit | 89e596f4e12c4a4c13224f15da7b6d079b97de0a (patch) | |
tree | 50dfa2066bdf9a6859fd45d5b3b8fc260714c668 | |
parent | Merge pull request #2438 from python-discord/mbaruh/timeout (diff) | |
parent | Remove usage of the muted role (diff) |
Merge pull request #2476 from python-discord/remove_muted_role
Remove usage of the muted role
-rw-r--r-- | bot/constants.py | 1 | ||||
-rw-r--r-- | bot/exts/moderation/infraction/infractions.py | 28 |
2 files changed, 0 insertions, 29 deletions
diff --git a/bot/constants.py b/bot/constants.py index 4553095f3..4186472b1 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -143,7 +143,6 @@ class _Roles(EnvConfig): contributors = 295488872404484098 help_cooldown = 699189276025421825 - muted = 277914926603829249 # TODO remove when no longer relevant. partners = 323426753857191936 python_community = 458226413825294336 voice_verified = 764802720779337729 diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py index 4ec9e41c7..d61a3fa5c 100644 --- a/bot/exts/moderation/infraction/infractions.py +++ b/bot/exts/moderation/infraction/infractions.py @@ -47,33 +47,8 @@ class Infractions(InfractionScheduler, commands.Cog): super().__init__(bot, supported_infractions={"ban", "kick", "timeout", "note", "warning", "voice_mute"}) self.category = "Moderation" - self._muted_role = discord.Object(constants.Roles.muted) # TODO remove when no longer relevant. self._voice_verified_role = discord.Object(constants.Roles.voice_verified) - @commands.Cog.listener() - async def on_member_join(self, member: Member) -> None: - """ - Apply active timeout infractions for returning members. - - This is only needed for users who received the old role-mute, and are returning before it's ended. - TODO remove when no longer relevant. - """ - active_timeouts = await self.bot.api_client.get( - "bot/infractions", - params={ - "active": "true", - "type": "timeout", - "user__id": member.id - } - ) - - if active_timeouts and not member.is_timed_out(): - reason = f"Applying active timeout for returning member: {active_timeouts[0]['id']}" - - async def action() -> None: - await member.edit(timed_out_until=arrow.get(active_timeouts[0]["expires_at"]).datetime, reason=reason) - await self.reapply_infraction(active_timeouts[0], action) - # region: Permanent infractions @command() @@ -574,9 +549,6 @@ class Infractions(InfractionScheduler, commands.Cog): if user: # Remove the timeout. self.mod_log.ignore(Event.member_update, user.id) - if user.get_role(self._muted_role.id): - # Compatibility with existing role mutes. TODO remove when no longer relevant. - await user.remove_roles(self._muted_role, reason=reason) if user.is_timed_out(): # Handle pardons via the command and any other obscure weirdness. log.trace(f"Manually pardoning timeout for user {user.id}") await user.edit(timed_out_until=None, reason=reason) |