Merge branch 'dev'
commit
a248474140
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue