This commit is contained in:
Christopher Cookman 2024-07-01 02:05:12 -06:00
parent 7b96229d01
commit 42487f22b6
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -85,7 +85,17 @@ const getUniqueChannels = function () {
if (err) {
console.error(err.message);
}
resolve(rows.length);
// Go through channels. and get number of unique guilds
const guilds = [];
rows.forEach((row) => {
const channel = discord.channels.cache.get(row.channelid);
if (!channel) return;
if (!guilds.includes(channel.guild.id)) {
guilds.push(channel.guild.id);
}
});
resolve({ channels: rows.length, guilds: guilds.length });
});
});
}
@ -891,7 +901,8 @@ discord.on("interactionCreate", async (interaction) => {
channels = row.count
await getUniqueChannels().then((unique) => {
uniques = unique;
uniques = unique.channels;
guilds = unique.guilds;
});
discord.users.fetch("289884287765839882").then((chrisUser) => {
const embed = {
@ -916,12 +927,12 @@ discord.on("interactionCreate", async (interaction) => {
},
{
name: "Subscribed Rooms",
value: channels.toLocaleString(),
value: `${channels.toLocaleString()}`,
inline: true
},
{
name: "Unique Channels",
value: uniques.toLocaleString(),
value: `${uniques.toLocaleString()} in ${guilds} guilds.`,
inline: true
}
],