Fixed info guild short-circuiting
This commit is contained in:
parent
c4b077757f
commit
576e55fbdf
|
@ -196,9 +196,8 @@ async function getGuildInfo(guild: Guild, currentGuild: Guild | null) {
|
|||
const iconURL = guild.iconURL({dynamic: true});
|
||||
const embed = new MessageEmbed().setDescription(`**Guild information for __${guild.name}__**`).setColor("BLUE");
|
||||
const displayRoles = !!(currentGuild && guild.id === currentGuild.id);
|
||||
if (iconURL) {
|
||||
|
||||
embed
|
||||
.setThumbnail(iconURL)
|
||||
.addField("General", [
|
||||
`**❯ Name:** ${guild.name}`,
|
||||
`**❯ ID:** ${guild.id}`,
|
||||
|
@ -207,9 +206,9 @@ async function getGuildInfo(guild: Guild, currentGuild: Guild | null) {
|
|||
`**❯ Boost Tier:** ${guild.premiumTier ? `Tier ${guild.premiumTier}` : "None"}`,
|
||||
`**❯ Explicit Filter:** ${filterLevels[guild.explicitContentFilter]}`,
|
||||
`**❯ Verification Level:** ${verificationLevels[guild.verificationLevel]}`,
|
||||
`**❯ Time Created:** ${moment(guild.createdTimestamp).format("LT")} ${moment(
|
||||
guild.createdTimestamp
|
||||
).format("LL")} ${moment(guild.createdTimestamp).fromNow()}`,
|
||||
`**❯ Time Created:** ${moment(guild.createdTimestamp).format("LT")} ${moment(guild.createdTimestamp).format(
|
||||
"LL"
|
||||
)} ${moment(guild.createdTimestamp).fromNow()}`,
|
||||
"\u200b"
|
||||
])
|
||||
.addField("Statistics", [
|
||||
|
@ -234,6 +233,8 @@ async function getGuildInfo(guild: Guild, currentGuild: Guild | null) {
|
|||
])
|
||||
.setTimestamp();
|
||||
|
||||
if (iconURL) embed.setThumbnail(iconURL);
|
||||
|
||||
// Only add the roles if the guild the bot is sending the message to is the same one that's being requested.
|
||||
if (displayRoles) {
|
||||
embed.addField(
|
||||
|
@ -241,7 +242,6 @@ async function getGuildInfo(guild: Guild, currentGuild: Guild | null) {
|
|||
roles.length < 10 ? roles.join(", ") : roles.length > 10 ? trimArray(roles) : "None"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue