Skip to content

Commit 80e7c4f

Browse files
committed
fix(utils/general): ensure typings for data response in getNsfwImage and cluster information in receiveBotInfo
1 parent 23a922a commit 80e7c4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/structures/utils/General.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ export default class GeneralUtils {
132132
const botinfoCache = this.client.cache.get('botInfo');
133133
if (botinfoCache && useCache) return botinfoCache;
134134
const cluster = this.client.cluster.id;
135-
const shards = this.client.cluster.ids.map((d) => `#${d.id}`).join(', ');
135+
const shards = Array.isArray(this.client.cluster.ids)
136+
? this.client.cluster.ids.map((id) => `#${id}`).join(', ')
137+
: this.client.cluster.ids.map((shard, id) => `#${id}`).join(', ');
136138
const guilds = this.client.guilds.cache.size;
137139
const members = this.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
138140
const memoryUsage = process.memoryUsage();
@@ -508,7 +510,7 @@ export default class GeneralUtils {
508510
});
509511

510512
const data = await response.json();
511-
const url = Object.values(data).find((v) => String(v).isValidUrl());
513+
const url = data && typeof data === 'object' ? Object.values(data).find((v) => String(v).isValidUrl()) : null;
512514

513515
return reply(url);
514516
} catch (e) {

0 commit comments

Comments
 (0)