fix: fix annotation issue for guild cache list

This commit is contained in:
Marius Begby committed 2023-08-27 18:28:01 +02:00
1 parent 45d6ffa179
commit 7185fe4071
2 files changed
+13 -13

No files matched your search

+9 -9
View File
@@ -32,11 +32,11 @@ module.exports = {
const usedMemoryInMB = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US'); const usedMemoryInMB = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US');
const cpuUsage = await osu.cpu.usage(); const cpuUsage = await osu.cpu.usage();
const releaseVersion = version; const releaseVersion = version;
let guildCount = 0; let guildCount: number = 0;
let memberCount = 0; let memberCount: number = 0;
let activeVoiceConnections = 0; let activeVoiceConnections: number = 0;
let totalTracks = 0; let totalTracks: number = 0;
let totalListeners = 0; let totalListeners: number = 0;
if (!client || !client.shard) { if (!client || !client.shard) {
logger.error('Client is undefined or does not have shard property.'); logger.error('Client is undefined or does not have shard property.');
@@ -75,11 +75,11 @@ module.exports = {
await client.shard await client.shard
.fetchClientValues('guilds.cache') .fetchClientValues('guilds.cache')
.then((results) => { .then((results) => {
const guildCaches = results as Collection<string, Guild>[]; const guildCaches = results as Guild[][];
guildCaches.map((guildCache) => { guildCaches.map((guildCache: Guild[]) => {
if (guildCache) { if (guildCache) {
guildCount += guildCache.size; guildCount += guildCache.length;
memberCount += guildCache.reduce((acc, guild) => acc + guild.memberCount, 0); memberCount += guildCache.reduce((acc: number, guild: Guild) => acc + guild.memberCount, 0);
} }
}); });
+4 -4
View File
@@ -96,11 +96,11 @@ module.exports = {
await client.shard await client.shard
.fetchClientValues('guilds.cache') .fetchClientValues('guilds.cache')
.then((results) => { .then((results) => {
const guildCaches = results as Collection<string, Guild>[]; const guildCaches = results as Guild[][];
guildCaches.map((guildCache) => { guildCaches.map((guildCache: Guild[]) => {
if (guildCache) { if (guildCache) {
guildCount += guildCache.size; guildCount += guildCache.length;
memberCount += guildCache.reduce((acc, guild) => acc + guild.memberCount, 0); memberCount += guildCache.reduce((acc: number, guild: Guild) => acc + guild.memberCount, 0);
} }
}); });
logger.debug('Successfully fetched client values from shards.'); logger.debug('Successfully fetched client values from shards.');