1
0
Fork 0

Switched type parser to switch

refactor/models
Bsian 2019-10-29 17:35:41 +00:00
parent 3ac6b28e38
commit c9fed63480
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 8 additions and 11 deletions

View File

@ -24,16 +24,13 @@ export default class Modlogs extends Command {
const formatted = query.map((log) => { const formatted = query.map((log) => {
const { username, moderatorID, reason, type, date } = log; const { username, moderatorID, reason, type, date } = log;
let name: string; let name: string;
if (type === 0) { switch (type) {
name = 'Create'; default: name = 'Generic'; break;
} else if (type === 1) { case 0: name = 'Create'; break;
name = 'Warn'; case 1: name = 'Warn'; break;
} else if (type === 2) { case 2: name = 'Lock'; break;
name = 'Lock'; case 3: name = 'Unlock'; break;
} else if (type === 3) { case 4: name = 'Delete'; break;
name = 'Unlock';
} else if (type === 4) {
name = 'Delete';
} }
const value = `**Account name:** ${username}\n**Moderator:** <@${moderatorID}>\n**Reason:** ${reason}\n**Date:** ${date.toLocaleString('en-us')} EST`; const value = `**Account name:** ${username}\n**Moderator:** <@${moderatorID}>\n**Reason:** ${reason}\n**Date:** ${date.toLocaleString('en-us')} EST`;
const inline = true; const inline = true;
@ -49,7 +46,7 @@ export default class Modlogs extends Command {
embed.setAuthor('Library of Code | Cloud Services', this.client.user.avatarURL, 'https://libraryofcode.org/'); embed.setAuthor('Library of Code | Cloud Services', this.client.user.avatarURL, 'https://libraryofcode.org/');
embed.setTitle('Cloud Modlogs/Infractions'); embed.setTitle('Cloud Modlogs/Infractions');
embed.setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, message.author.avatarURL); embed.setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, message.author.avatarURL);
l.forEach((f) => { this.client.signale.note(f); embed.addField(f.name, f.value, f.inline); }); l.forEach((f) => embed.addField(f.name, f.value, f.inline));
embed.setTimestamp(); embed.setTimestamp();
embed.setColor(3447003); embed.setColor(3447003);
return embed; return embed;