add colors to mod embeds and code refactor
parent
9e50426095
commit
563db7d9a7
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable no-bitwise */
|
||||
import { Member } from 'eris';
|
||||
import { Member, User } from 'eris';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import moment, { unitOfTime } from 'moment';
|
||||
import { Client, RichEmbed } from '.';
|
||||
|
@ -40,11 +40,11 @@ export default class Moderation {
|
|||
return moment.duration(length, unit).asMilliseconds();
|
||||
}
|
||||
|
||||
public async ban(member: Member, moderator: Member, duration: number, reason?: string): Promise<ModerationInterface> {
|
||||
await member.ban(7, reason);
|
||||
public async ban(user: User, moderator: Member, duration: number, reason?: string): Promise<ModerationInterface> {
|
||||
await this.client.guilds.get(this.client.config.guildID).banMember(user.id, 7, reason);
|
||||
const logID = uuid();
|
||||
const mod = new ModerationModel({
|
||||
userID: member.id,
|
||||
userID: user.id,
|
||||
logID,
|
||||
moderatorID: moderator.id,
|
||||
reason: reason ?? null,
|
||||
|
@ -63,9 +63,10 @@ export default class Moderation {
|
|||
|
||||
const embed = new RichEmbed();
|
||||
embed.setTitle(`Case ${logID} | Ban`);
|
||||
embed.setAuthor(member.user.username, member.user.avatarURL);
|
||||
embed.setThumbnail(member.user.avatarURL);
|
||||
embed.addField('User', `<@${member.id}>`, true);
|
||||
embed.setColor('#e74c3c');
|
||||
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);
|
||||
|
@ -95,6 +96,7 @@ export default class Moderation {
|
|||
|
||||
const embed = new RichEmbed();
|
||||
embed.setTitle(`Case ${logID} | Unban`);
|
||||
embed.setColor('#1abc9c');
|
||||
embed.setAuthor(user.username, user.avatarURL);
|
||||
embed.setThumbnail(user.avatarURL);
|
||||
embed.addField('User', `<@${user.id}>`, true);
|
||||
|
|
Loading…
Reference in New Issue