3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 14:11:50 +00:00

Merge pull request #25 from roflmaoqwerty/compact-info

Add -compact/-c flag to !info
This commit is contained in:
Miikka 2020-01-12 11:45:29 +02:00 committed by GitHub
commit 65880d2e60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -792,9 +792,16 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
basicUsage: "!info 106391128718245888", basicUsage: "!info 106391128718245888",
}, },
}, },
options: [
{
name: "compact",
shortcut: "c",
isSwitch: true,
}
]
}) })
@d.permission("can_info") @d.permission("can_info")
async infoCmd(msg: Message, args: { user?: User | UnknownUser }) { async infoCmd(msg: Message, args: { user?: User | UnknownUser, compact?: boolean }) {
const user = args.user || msg.author; const user = args.user || msg.author;
let member; let member;
@ -816,15 +823,42 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
embed.title = `${user.username}#${user.discriminator}`; embed.title = `${user.username}#${user.discriminator}`;
embed.thumbnail = { url: user.avatarURL }; embed.thumbnail = { url: user.avatarURL };
embed.fields.push({ if(args.compact){
name: "User information", embed.fields.push({
value: name: "User information",
trimLines(` value:
ID: **${user.id}** trimLines(`
Profile: <@!${user.id}> Profile: <@!${user.id}>
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})** Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`) + embedPadding, `),
}); });
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{
embed.fields.push({
name: "User information",
value:
trimLines(`
ID: **${user.id}**
Profile: <@!${user.id}>
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`) + embedPadding,
});
}
} else { } else {
embed.title = `Unknown user`; embed.title = `Unknown user`;
} }
@ -863,8 +897,8 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
name: "!! USER IS NOT ON THE SERVER !!", name: "!! USER IS NOT ON THE SERVER !!",
value: embedPadding, value: embedPadding,
}); });
}
}
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) {
@ -886,7 +920,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
`), `),
}); });
} }
msg.channel.createMessage({ embed }); msg.channel.createMessage({ embed });
} }