diff options
| author | 2019-12-09 23:41:27 -0800 | |
|---|---|---|
| committer | 2019-12-09 23:51:05 -0800 | |
| commit | f0e993a3514c1ef7256c4b7593d4db94a6d34569 (patch) | |
| tree | 78c4932a9b3b216945d1ea98288321a0e0131a25 | |
| parent | Moderation: catch HTTPException when applying an infraction (diff) | |
Infractions: kick user from voice after muting (#644)
| -rw-r--r-- | bot/cogs/moderation/infractions.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index 2713a1b68..fe5150652 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -208,8 +208,13 @@ class Infractions(InfractionScheduler, commands.Cog): self.mod_log.ignore(Event.member_update, user.id) - action = user.add_roles(self._muted_role, reason=reason) - await self.apply_infraction(ctx, infraction, user, action) + async def action() -> None: + await user.add_roles(self._muted_role, reason=reason) + + log.trace(f"Attempting to kick {user} from voice because they've been muted.") + await user.move_to(None, reason=reason) + + await self.apply_infraction(ctx, infraction, user, action()) @respect_role_hierarchy() async def apply_kick(self, ctx: Context, user: Member, reason: str, **kwargs) -> None: |