From 097fcee68c5068ae413b320e0e2357d08394f55b Mon Sep 17 00:00:00 2001 From: Sai Teja Madha <42540377+saiteja-madha@users.noreply.github.com> Date: Fri, 24 Sep 2021 19:54:47 +0530 Subject: [PATCH] unmute fixes --- src/schemas/modlog-schema.js | 4 ++-- src/utils/modUtils.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/schemas/modlog-schema.js b/src/schemas/modlog-schema.js index 4c20079fc..a11cd7ad2 100644 --- a/src/schemas/modlog-schema.js +++ b/src/schemas/modlog-schema.js @@ -70,10 +70,10 @@ module.exports = { member_id: targetId, type: "MUTE", "data.current": true, - }), + }).lean({ defaults: true }), removeMutes: async (guildId, targetId) => - Model.updateOne( + Model.updateMany( { guild_id: guildId, member_id: targetId, diff --git a/src/utils/modUtils.js b/src/utils/modUtils.js index 431d0cd5c..44b43cb4b 100644 --- a/src/utils/modUtils.js +++ b/src/utils/modUtils.js @@ -227,7 +227,7 @@ async function unmuteTarget(issuer, target, reason) { let mutedRole = getRoleByName(issuer.guild, "muted"); try { await removeMutes(issuer.guild.id, target.id); - if (target.roles.cache.has(mutedRole)) await target.roles.remove(mutedRole); + if (hasMutedRole(target)) await target.roles.remove(mutedRole); await logModeration(issuer, target, reason, "Unmute"); return true; } catch (ex) {