Merge branch 'dev'

pull/29/head
Matthew 2020-07-09 04:49:23 -04:00
commit a248474140
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 6 additions and 8 deletions

View File

@ -157,11 +157,10 @@ export default class Moderation {
public async unmute(userID: string, moderator: Member, reason?: string): Promise<ModerationInterface> { public async unmute(userID: string, moderator: Member, reason?: string): Promise<ModerationInterface> {
const member = await this.client.getRESTGuildMember(this.client.config.guildID, userID); const member = await this.client.getRESTGuildMember(this.client.config.guildID, userID);
if (!member) { const user = await this.client.getRESTUser(this.client.config.guildID);
await this.client.db.local.del(`muted-${userID}`); if (member) {
throw new Error('Member doesn\'t exist.'); await member.removeRole('478373942638149643');
} }
await member.removeRole('478373942638149643');
const logID = randomBytes(2).toString('hex'); const logID = randomBytes(2).toString('hex');
const mod = new ModerationModel({ const mod = new ModerationModel({
userID, userID,
@ -177,9 +176,9 @@ export default class Moderation {
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTitle(`Case ${logID} | Unmute`); embed.setTitle(`Case ${logID} | Unmute`);
embed.setColor('#1abc9c'); embed.setColor('#1abc9c');
embed.setAuthor(member.user.username, member.user.avatarURL); embed.setAuthor(user.username, user.avatarURL);
embed.setThumbnail(member.user.avatarURL); embed.setThumbnail(user.avatarURL);
embed.addField('User', `<@${member.user.id}>`, true); embed.addField('User', `<@${user.id}>`, true);
embed.addField('Moderator', `<@${moderator.id}>`, true); embed.addField('Moderator', `<@${moderator.id}>`, true);
if (reason) { if (reason) {
embed.addField('Reason', reason, true); embed.addField('Reason', reason, true);

View File

@ -18,7 +18,6 @@ export default function checkLock(client: Client): NodeJS.Timeout {
await client.util.moderation.unban(moderation.userID, system); await client.util.moderation.unban(moderation.userID, system);
break; break;
case 2: case 2:
console.log(await client.db.local.get<boolean>(`muted-${moderation.userID}`));
if (await client.db.local.get<boolean>(`muted-${moderation.userID}`) === true) { if (await client.db.local.get<boolean>(`muted-${moderation.userID}`) === true) {
await client.util.moderation.unmute(moderation.userID, system); await client.util.moderation.unmute(moderation.userID, system);
} }