From 0ee5f0a8639e9fced924f283e3a3b28bfbb32ede Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:09:09 +0300 Subject: [PATCH] fix: additional checks for unmuting without an active mute --- backend/src/plugins/Mutes/functions/clearMute.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/plugins/Mutes/functions/clearMute.ts b/backend/src/plugins/Mutes/functions/clearMute.ts index eba6de34..ba6577bc 100644 --- a/backend/src/plugins/Mutes/functions/clearMute.ts +++ b/backend/src/plugins/Mutes/functions/clearMute.ts @@ -50,10 +50,12 @@ export async function clearMute( } else { // Unmuting someone without an active mute -> remove timeouts and/or mute role const muteRole = pluginData.config.get().mute_role; - if (muteRole) { + if (muteRole && member.roles.cache.has(muteRole)) { await member.roles.remove(muteRole); } - await member.timeout(null); + if (member.communicationDisabledUntilTimestamp) { + await member.timeout(null); + } } } catch { pluginData.getPlugin(LogsPlugin).logBotAlert({