utility.guildinfo: fixes and rearranging

This commit is contained in:
Cynthia Foxwell 2023-10-08 16:02:16 -06:00
parent 877398686b
commit 74ee9c15f9

View file

@ -1813,6 +1813,16 @@ guildinfo.callback = async function (msg, line) {
title: guild.name, title: guild.name,
description: guild.description ?? "*No description.*", description: guild.description ?? "*No description.*",
fields: [ fields: [
guild.ownerID && {
name: "Owner",
value: `<@${guild.ownerID}>`,
inline: true,
},
guild.vanityURL && {
name: "Vanity URL",
value: `https://discord.gg/${guild.vanityURL}`,
inline: true,
},
{ {
name: "Created", name: "Created",
value: `<t:${Math.floor(snowflakeToTimestamp(guild.id) / 1000)}:R>`, value: `<t:${Math.floor(snowflakeToTimestamp(guild.id) / 1000)}:R>`,
@ -1834,7 +1844,7 @@ guildinfo.callback = async function (msg, line) {
inline: true, inline: true,
}, },
{ {
name: "Explicit Content Filter Level", name: "Content Filter",
value: GUILD_CONTENT_FILTER[guild.explicitContentFilter], value: GUILD_CONTENT_FILTER[guild.explicitContentFilter],
inline: true, inline: true,
}, },
@ -1867,8 +1877,8 @@ guildinfo.callback = async function (msg, line) {
Object.entries(channelTypeCounts) Object.entries(channelTypeCounts)
.map(([type, count]) => `${count} ${CHANNEL_TYPE_NAMES[type]}`) .map(([type, count]) => `${count} ${CHANNEL_TYPE_NAMES[type]}`)
.join(", ") + .join(", ") +
`\n\n${nsfwChannels} age restricted, ${hiddenChannels} hidden`, `\n${nsfwChannels} age restricted, ${hiddenChannels} hidden`,
inline: true, inline: false,
}, },
{ {
name: `Roles (${guild.roles.size})`, name: `Roles (${guild.roles.size})`,
@ -1905,7 +1915,7 @@ guildinfo.callback = async function (msg, line) {
} unavailable`, } unavailable`,
inline: true, inline: true,
}, },
], ].filter((x) => !!x),
}; };
if (guild.icon) { if (guild.icon) {
@ -1918,25 +1928,9 @@ guildinfo.callback = async function (msg, line) {
}; };
} }
if (guild.ownerID) {
embed.fields.push({
name: "Owner",
value: `<@${guild.ownerID}>`,
inline: true,
});
}
if (guild.vanityURL) {
embed.fields.push({
name: "Vanity URL",
value: `https://discord.gg/${guild.vanityURL}`,
inline: true,
});
}
if (guild.systemChannelID) { if (guild.systemChannelID) {
embed.fields.push({ embed.fields.push({
name: "System Messages Channel", name: "System Messages",
value: `#${guild.channels.get(guild.systemChannelID).name} (\`${ value: `#${guild.channels.get(guild.systemChannelID).name} (\`${
guild.systemChannelID guild.systemChannelID
}\`)`, }\`)`,
@ -1945,7 +1939,7 @@ guildinfo.callback = async function (msg, line) {
} }
if (guild.rulesChannelID) { if (guild.rulesChannelID) {
embed.fields.push({ embed.fields.push({
name: "Rules Channel", name: "Rules",
value: `#${guild.channels.get(guild.rulesChannelID).name} (\`${ value: `#${guild.channels.get(guild.rulesChannelID).name} (\`${
guild.rulesChannelID guild.rulesChannelID
}\`)`, }\`)`,
@ -1954,7 +1948,7 @@ guildinfo.callback = async function (msg, line) {
} }
if (guild.publicUpdatesChannelID) { if (guild.publicUpdatesChannelID) {
embed.fields.push({ embed.fields.push({
name: "Community Updates Channel", name: "Community Updates",
value: `#${ value: `#${
guild.channels.get(guild.publicUpdatesChannelID).name guild.channels.get(guild.publicUpdatesChannelID).name
} (\`${guild.publicUpdatesChannelID}\`)`, } (\`${guild.publicUpdatesChannelID}\`)`,
@ -1963,7 +1957,7 @@ guildinfo.callback = async function (msg, line) {
} }
if (guild.safetyAlertsChannelID) { if (guild.safetyAlertsChannelID) {
embed.fields.push({ embed.fields.push({
name: "Safety Alerts Channel", name: "Safety Alerts",
value: `#${guild.channels.get(guild.safetyAlertsChannelID).name} (\`${ value: `#${guild.channels.get(guild.safetyAlertsChannelID).name} (\`${
guild.safetyAlertsChannelID guild.safetyAlertsChannelID
}\`)`, }\`)`,
@ -1977,7 +1971,7 @@ guildinfo.callback = async function (msg, line) {
).length; ).length;
const bots = members.filter((member) => member.bot).length; const bots = members.filter((member) => member.bot).length;
const verfifiedBots = members.filter( const verfifiedBots = members.filter(
(member) => member.bot && (member.user.flags & 65536) != 0 (member) => member.bot && (member.user.publicFlags & 65536) != 0
).length; ).length;
embed.fields.push({ embed.fields.push({
name: "Member Count", name: "Member Count",