Fixed info guild short-circuiting

This commit is contained in:
WatDuhHekBro 2021-04-20 10:50:57 -05:00
parent c4b077757f
commit 576e55fbdf
No known key found for this signature in database
GPG key ID: E128514902DF8A05

View file

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