Explorar o código

Report (un)mute fail

ghorsington %!s(int64=3) %!d(string=hai) anos
pai
achega
37ab09d4a5
Modificáronse 1 ficheiros con 10 adicións e 3 borrados
  1. 10 3
      bot/src/plugins/violation.ts

+ 10 - 3
bot/src/plugins/violation.ts

@@ -79,12 +79,19 @@ export class ViolationPlugin {
                     return;
                 }
 
-                await memberResolve.result.roles.remove(muteRole);
+                const member = memberResolve.result;
+                const unmuteResult = await tryDo(member.roles.remove(muteRole));
+                if (!unmuteResult.ok) {
+                    logger.error("mute: failed to unmute user %s#%s (%s). Maybe he's already unmuted?",
+                        member.user?.username,
+                        member.user?.discriminator,
+                        member.user?.id,);
+                }
                 const mute = violation as Mute;
                 if (mute.previousRoles) {
-                    const result = await tryDo(memberResolve.result.roles.set(mute.previousRoles));
+                    const result = await tryDo(member.roles.set(mute.previousRoles));
                     if (!result.ok) {
-                        logger.warn("mute: couldn't readd all roles for user %s (tried to restore role ids: %s)", memberResolve.result.id, mute.previousRoles.join(", "));
+                        logger.warn("mute: couldn't readd all roles for user %s (tried to restore role ids: %s)", member.id, mute.previousRoles.join(", "));
                     }
                 }
             },