aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/moderation/infraction/infractions.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/moderation/infraction/infractions.py')
-rw-r--r--bot/exts/moderation/infraction/infractions.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py
index 78c326c47..be4327bb0 100644
--- a/bot/exts/moderation/infraction/infractions.py
+++ b/bot/exts/moderation/infraction/infractions.py
@@ -355,14 +355,15 @@ class Infractions(InfractionScheduler, commands.Cog):
if reason:
reason = textwrap.shorten(reason, width=512, placeholder="...")
- action = None
+ async def action() -> None:
+ # Skip members that left the server
+ if not isinstance(user, Member):
+ return
- # Skip members that left the server
- if isinstance(user, Member):
await user.move_to(None, reason="Disconnected from voice to apply voiceban.")
- action = user.remove_roles(self._voice_verified_role, reason=reason)
+ await user.remove_roles(self._voice_verified_role, reason=reason)
- await self.apply_infraction(ctx, infraction, user, action)
+ await self.apply_infraction(ctx, infraction, user, action())
# endregion
# region: Base pardon functions