From 7185fe4071990b822d9b4cd2eb983302dce50345 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sun, 27 Aug 2023 18:28:01 +0200 Subject: [PATCH] fix: fix annotation issue for guild cache list --- src/commands/info/status.ts | 18 +++++++++--------- src/commands/system/systemstatus.ts | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/commands/info/status.ts b/src/commands/info/status.ts index afced7a..41b3221 100644 --- a/src/commands/info/status.ts +++ b/src/commands/info/status.ts @@ -32,11 +32,11 @@ module.exports = { const usedMemoryInMB = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US'); const cpuUsage = await osu.cpu.usage(); const releaseVersion = version; - let guildCount = 0; - let memberCount = 0; - let activeVoiceConnections = 0; - let totalTracks = 0; - let totalListeners = 0; + let guildCount: number = 0; + let memberCount: number = 0; + let activeVoiceConnections: number = 0; + let totalTracks: number = 0; + let totalListeners: number = 0; if (!client || !client.shard) { logger.error('Client is undefined or does not have shard property.'); @@ -75,11 +75,11 @@ module.exports = { await client.shard .fetchClientValues('guilds.cache') .then((results) => { - const guildCaches = results as Collection[]; - guildCaches.map((guildCache) => { + const guildCaches = results as Guild[][]; + guildCaches.map((guildCache: Guild[]) => { if (guildCache) { - guildCount += guildCache.size; - memberCount += guildCache.reduce((acc, guild) => acc + guild.memberCount, 0); + guildCount += guildCache.length; + memberCount += guildCache.reduce((acc: number, guild: Guild) => acc + guild.memberCount, 0); } }); diff --git a/src/commands/system/systemstatus.ts b/src/commands/system/systemstatus.ts index ee32d6e..9585010 100644 --- a/src/commands/system/systemstatus.ts +++ b/src/commands/system/systemstatus.ts @@ -96,11 +96,11 @@ module.exports = { await client.shard .fetchClientValues('guilds.cache') .then((results) => { - const guildCaches = results as Collection[]; - guildCaches.map((guildCache) => { + const guildCaches = results as Guild[][]; + guildCaches.map((guildCache: Guild[]) => { if (guildCache) { - guildCount += guildCache.size; - memberCount += guildCache.reduce((acc, guild) => acc + guild.memberCount, 0); + guildCount += guildCache.length; + memberCount += guildCache.reduce((acc: number, guild: Guild) => acc + guild.memberCount, 0); } }); logger.debug('Successfully fetched client values from shards.');