userinfo: oop
This commit is contained in:
parent
29f381b18a
commit
2fca9ed7a8
1 changed files with 5 additions and 12 deletions
|
@ -306,7 +306,8 @@ userinfo.callback = async function (msg, line) {
|
||||||
descLines.push("**System account**");
|
descLines.push("**System account**");
|
||||||
}
|
}
|
||||||
|
|
||||||
const primaryGuild = await getGuild(user.primary_guild.identity_guild_id);
|
let primaryGuild;
|
||||||
|
if (user.primary_guild?.identity_guild_id) primaryGuild = await getGuild(user.primary_guild.identity_guild_id);
|
||||||
|
|
||||||
if (anyMember) {
|
if (anyMember) {
|
||||||
const icons = [];
|
const icons = [];
|
||||||
|
@ -393,11 +394,11 @@ userinfo.callback = async function (msg, line) {
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
member?.roles?.length > 0 && {
|
member?.roles?.length > 0 && {
|
||||||
name: "Roles",
|
name: `Roles (${member.roles.length})`,
|
||||||
value: member.roles
|
value: member.roles
|
||||||
.sort((a, b) => guild.roles.get(b).position - guild.roles.get(a).position)
|
.sort((a, b) => guild.roles.get(b).position - guild.roles.get(a).position)
|
||||||
.map((role) => `<@&${role}>`)
|
.map((role) => `<@&${role}>`)
|
||||||
.join(", "),
|
.join(" "),
|
||||||
inline: false,
|
inline: false,
|
||||||
},
|
},
|
||||||
shared.length > 0 && {
|
shared.length > 0 && {
|
||||||
|
@ -408,7 +409,7 @@ userinfo.callback = async function (msg, line) {
|
||||||
images.length > 0 && {
|
images.length > 0 && {
|
||||||
name: "\u200b",
|
name: "\u200b",
|
||||||
value: images.join("\u3000"),
|
value: images.join("\u3000"),
|
||||||
inline: true,
|
inline: false,
|
||||||
},
|
},
|
||||||
].filter((x) => !!x),
|
].filter((x) => !!x),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -416,14 +417,6 @@ userinfo.callback = async function (msg, line) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (embed.fields.length == 2) {
|
|
||||||
// assumed created + images
|
|
||||||
embed.fields[1].inline = false;
|
|
||||||
} else if (embed.fields.length == 3) {
|
|
||||||
// assumed created + clan + images
|
|
||||||
embed.fields[2].inline = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {embeds: [embed]};
|
return {embeds: [embed]};
|
||||||
};
|
};
|
||||||
hf.registerCommand(userinfo);
|
hf.registerCommand(userinfo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue