cleaner score embeds

pull/29/head
Matthew 2020-09-13 01:09:25 -04:00
parent 2e6f494c79
commit 286d720c2a
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 16 additions and 3 deletions

View File

@ -84,14 +84,27 @@ export default class Score extends Command {
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTitle('Community Score'); embed.setTitle('Community Score');
embed.setAuthor(member.user.username, member.user.avatarURL); embed.setAuthor(member.user.username, member.user.avatarURL);
embed.setThumbnail(member.user.avatarURL);
/* for (const role of member.roles.map((r) => this.mainGuild.roles.get(r)).sort((a, b) => b.position - a.position)) {
if (role?.color !== 0) {
embed.setColor(role.color);
break;
}
} */
if (score.inquiries?.length > 0) { if (score.inquiries?.length > 0) {
let desc = ''; let desc = '__**Hard Inquiries**__\n*These inquiries will fall off your report within 3 months, try to keep your hard inquiries to a minimum. If you want to file a dispute, please DM Ramirez.*\n\n';
score.inquiries.forEach((inq) => { score.inquiries.forEach((inq) => {
desc += `**Department/Service:** ${inq.name}\n**Reason:** ${inq.reason}\n**Date:** ${inq.date.toLocaleString('en-us')} ET\n`; const testDate = (new Date(new Date(inq.date).setHours(2190)));
if (testDate > inq.date) desc += `**Department/Service:** ${inq.name}\n**Reason:** ${inq.reason}\n**Date:** ${inq.date.toLocaleString('en-us')} ET\n\n`;
}); });
embed.setDescription(desc); embed.setDescription(desc);
} }
embed.addField('Total | 200 - 800', totalScore, true); let color = '🔴';
embed.setColor('FF0000');
if (score.total >= 280) { color = '🟠'; embed.setColor('FFA500'); }
if (score.total >= 490) { color = '🟡'; embed.setColor('FFFF00'); }
if (score.total >= 600) { color = '🟢'; embed.setColor('66FF66'); }
embed.addField('Total | 200 - 800', `${color} ${totalScore}`, true);
embed.addField(`Activity | 10 - ${Math.floor(Math.log1p(1000 + 300 + 200) * 12)}`, activityScore, true); embed.addField(`Activity | 10 - ${Math.floor(Math.log1p(1000 + 300 + 200) * 12)}`, activityScore, true);
embed.addField('Roles | 1 - 54', roleScore, true); embed.addField('Roles | 1 - 54', roleScore, true);
embed.addField('Moderation | -50 - 2', moderationScore, true); embed.addField('Moderation | -50 - 2', moderationScore, true);