aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2020-12-29 19:12:53 +0300
committerGravatar Hassan Abouelela <[email protected]>2020-12-29 19:12:53 +0300
commitf8afee54c3ffb1bfee3fca443738f4e91b3d1565 (patch)
tree40db55236e8a956ed2895f928d23a83d0437b869
parentRefractors Helper Method Signatures (diff)
Adds Error Handling For Voice Channel Muting
Adds error handlers to allow voice channel muting to handle as many members as possible.
-rw-r--r--bot/exts/moderation/silence.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/bot/exts/moderation/silence.py b/bot/exts/moderation/silence.py
index 31103bc3e..157c150fd 100644
--- a/bot/exts/moderation/silence.py
+++ b/bot/exts/moderation/silence.py
@@ -277,7 +277,12 @@ class Silence(commands.Cog):
for member in channel.members:
if self._helper_role not in member.roles:
- await member.move_to(None, reason="Kicking member from voice channel.")
+ try:
+ await member.move_to(None, reason="Kicking member from voice channel.")
+ log.debug(f"Kicked {member.name} from voice channel.")
+ except Exception as e:
+ log.debug(f"Failed to move {member.name}. Reason: {e}")
+ continue
log.debug("Removed all members.")
@@ -298,11 +303,15 @@ class Silence(commands.Cog):
if self._helper_role in member.roles:
continue
- await member.move_to(afk_channel, reason="Muting VC member.")
- log.debug(f"Moved {member.name} to afk channel.")
+ try:
+ await member.move_to(afk_channel, reason="Muting VC member.")
+ log.debug(f"Moved {member.name} to afk channel.")
- await member.move_to(channel, reason="Muting VC member.")
- log.debug(f"Moved {member.name} to original voice channel.")
+ await member.move_to(channel, reason="Muting VC member.")
+ log.debug(f"Moved {member.name} to original voice channel.")
+ except Exception as e:
+ log.debug(f"Failed to move {member.name}. Reason: {e}")
+ continue
finally:
# Delete VC channel if it was created.