3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-18 15:00:00 +00:00

Cleaned up code

This commit is contained in:
roflmaoqwerty 2020-01-11 02:05:54 +11:00
parent 12d8b19561
commit 4623475fb5

View file

@ -832,6 +832,21 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})** Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`), `),
}); });
if (member) {
const joinedAt = moment(member.joinedAt);
const joinAge = humanizeDuration(moment().valueOf() - member.joinedAt, {
largest: 2,
round: true,
});
embed.fields[0].value += `\nJoined: **${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")})**`
} else {
embed.fields.push({
name: "!! USER IS NOT ON THE SERVER !!",
value: embedPadding,
});
}
msg.channel.createMessage({ embed });
return;
} }
else{ else{
embed.fields.push({ embed.fields.push({
@ -856,10 +871,6 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
}); });
const roles = member.roles.map(id => this.guild.roles.get(id)).filter(r => !!r); const roles = member.roles.map(id => this.guild.roles.get(id)).filter(r => !!r);
if(args.compact){
embed.fields[0].value += `\n` + trimLines(`Joined: **${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")})**`);
}
else{
embed.fields.push({ embed.fields.push({
name: "Member information", name: "Member information",
value: value:
@ -868,8 +879,6 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
${roles.length > 0 ? "Roles: " + roles.map(r => r.name).join(", ") : ""} ${roles.length > 0 ? "Roles: " + roles.map(r => r.name).join(", ") : ""}
`) + embedPadding, `) + embedPadding,
}); });
}
if(!args.compact){
const voiceChannel = member.voiceState.channelID ? this.guild.channels.get(member.voiceState.channelID) : null; const voiceChannel = member.voiceState.channelID ? this.guild.channels.get(member.voiceState.channelID) : null;
if (voiceChannel || member.voiceState.mute || member.voiceState.deaf) { if (voiceChannel || member.voiceState.mute || member.voiceState.deaf) {
embed.fields.push({ embed.fields.push({
@ -882,14 +891,12 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
`) + embedPadding, `) + embedPadding,
}); });
} }
}
} else { } else {
embed.fields.push({ embed.fields.push({
name: "!! USER IS NOT ON THE SERVER !!", name: "!! USER IS NOT ON THE SERVER !!",
value: embedPadding, value: embedPadding,
}); });
} }
if(!args.compact){
const cases = (await this.cases.getByUserId(user.id)).filter(c => !c.is_hidden); const cases = (await this.cases.getByUserId(user.id)).filter(c => !c.is_hidden);
if (cases.length > 0) { if (cases.length > 0) {
@ -911,7 +918,6 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
`), `),
}); });
} }
}
msg.channel.createMessage({ embed }); msg.channel.createMessage({ embed });
} }