Added compact switch to !info

This commit is contained in:
roflmaoqwerty 2020-01-11 01:39:02 +11:00
parent c255019d43
commit 12d8b19561

View file

@ -792,9 +792,16 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
basicUsage: "!info 106391128718245888",
},
},
options: [
{
name: "compact",
shortcut: "c",
isSwitch: true,
}
]
})
@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;
let member;
@ -816,6 +823,17 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
embed.title = `${user.username}#${user.discriminator}`;
embed.thumbnail = { url: user.avatarURL };
if(args.compact){
embed.fields.push({
name: "User information",
value:
trimLines(`
Profile: <@!${user.id}>
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`),
});
}
else{
embed.fields.push({
name: "User information",
value:
@ -825,6 +843,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`) + embedPadding,
});
}
} else {
embed.title = `Unknown user`;
}
@ -837,6 +856,10 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
});
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({
name: "Member information",
value:
@ -845,7 +868,8 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
${roles.length > 0 ? "Roles: " + roles.map(r => r.name).join(", ") : ""}
`) + embedPadding,
});
}
if(!args.compact){
const voiceChannel = member.voiceState.channelID ? this.guild.channels.get(member.voiceState.channelID) : null;
if (voiceChannel || member.voiceState.mute || member.voiceState.deaf) {
embed.fields.push({
@ -858,13 +882,14 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
`) + embedPadding,
});
}
}
} else {
embed.fields.push({
name: "!! USER IS NOT ON THE SERVER !!",
value: embedPadding,
});
}
if(!args.compact){
const cases = (await this.cases.getByUserId(user.id)).filter(c => !c.is_hidden);
if (cases.length > 0) {
@ -886,7 +911,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
`),
});
}
}
msg.channel.createMessage({ embed });
}