From 7c5fce7c1fbd3d542b74c253d792881a7a21c369 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Thu, 9 Jul 2020 04:49:09 -0400 Subject: [PATCH] various fixes --- src/class/Moderation.ts | 13 ++++++------- src/intervals/autoRelease.ts | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/class/Moderation.ts b/src/class/Moderation.ts index f796997..a22c786 100644 --- a/src/class/Moderation.ts +++ b/src/class/Moderation.ts @@ -157,11 +157,10 @@ export default class Moderation { public async unmute(userID: string, moderator: Member, reason?: string): Promise { const member = await this.client.getRESTGuildMember(this.client.config.guildID, userID); - if (!member) { - await this.client.db.local.del(`muted-${userID}`); - throw new Error('Member doesn\'t exist.'); + const user = await this.client.getRESTUser(this.client.config.guildID); + if (member) { + await member.removeRole('478373942638149643'); } - await member.removeRole('478373942638149643'); const logID = randomBytes(2).toString('hex'); const mod = new ModerationModel({ userID, @@ -177,9 +176,9 @@ export default class Moderation { const embed = new RichEmbed(); embed.setTitle(`Case ${logID} | Unmute`); embed.setColor('#1abc9c'); - embed.setAuthor(member.user.username, member.user.avatarURL); - embed.setThumbnail(member.user.avatarURL); - embed.addField('User', `<@${member.user.id}>`, true); + embed.setAuthor(user.username, user.avatarURL); + embed.setThumbnail(user.avatarURL); + embed.addField('User', `<@${user.id}>`, true); embed.addField('Moderator', `<@${moderator.id}>`, true); if (reason) { embed.addField('Reason', reason, true); diff --git a/src/intervals/autoRelease.ts b/src/intervals/autoRelease.ts index 74f144f..20580b5 100644 --- a/src/intervals/autoRelease.ts +++ b/src/intervals/autoRelease.ts @@ -18,7 +18,6 @@ export default function checkLock(client: Client): NodeJS.Timeout { await client.util.moderation.unban(moderation.userID, system); break; case 2: - console.log(await client.db.local.get(`muted-${moderation.userID}`)); if (await client.db.local.get(`muted-${moderation.userID}`) === true) { await client.util.moderation.unmute(moderation.userID, system); }