Skip to content

Commit

Permalink
fix: stat reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
RozmarinUS committed May 28, 2024
1 parent a1599ff commit c9aaff7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/stat-reporter/nestcord-stat-reporter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export class NestCordStatReporterService implements OnModuleInit {

onModuleInit() {
this.client.on('ready', () => {
if (!this.options.development) {
const isFirstShard = this.client.shard?.ids?.[0] === 0;
const isProduction = !this.options.development;

if (isFirstShard && isProduction) {
this.setupCronJobs();
}
});
Expand All @@ -38,7 +41,6 @@ export class NestCordStatReporterService implements OnModuleInit {
await this.client.application.fetch();
let serverCount: number;
const shardCount = this.client.shard?.count;

if (this.client.shard) {
const totalServersOnAllShards = await this.client.shard.fetchClientValues('guilds.cache.size') as number[]
serverCount = totalServersOnAllShards.reduce((acc, guildCount) => acc + guildCount, 0) || this.client.application.approximateGuildCount;
Expand Down

0 comments on commit c9aaff7

Please sign in to comment.