From f0a60fd38520ff5c3e307f72f8dc8dbe8a7452a5 Mon Sep 17 00:00:00 2001 From: Dark <7890309+DarkView@users.noreply.github.com> Date: Fri, 12 Feb 2021 18:07:15 +0100 Subject: [PATCH] Allow kicking the user from VC on mute If any non-id string is entered in `move_to_voice_channel`, the user is kicked from the VC instead of being moved. We do not automatically kick if the option is set to null in order to not make this a breaking change for old, intended behavior --- backend/src/plugins/Mutes/functions/muteUser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Mutes/functions/muteUser.ts b/backend/src/plugins/Mutes/functions/muteUser.ts index 1ccbcc35..68c6724f 100644 --- a/backend/src/plugins/Mutes/functions/muteUser.ts +++ b/backend/src/plugins/Mutes/functions/muteUser.ts @@ -89,9 +89,10 @@ export async function muteUser( } // If enabled, move the user to the mute voice channel (e.g. afk - just to apply the voice perms from the mute role) - const moveToVoiceChannelId = pluginData.config.get().move_to_voice_channel; + let moveToVoiceChannelId = pluginData.config.get().move_to_voice_channel; if (moveToVoiceChannelId) { // TODO: Add back the voiceState check once we figure out how to get voice state for guild members that are loaded on-demand + if (moveToVoiceChannelId.match(".*[^0-9].*")) moveToVoiceChannelId = null; try { await member.edit({ channelID: moveToVoiceChannelId }); } catch (e) {} // tslint:disable-line