From 33808685f3adbf604d9eda2f3f66e3bdc68d0edf Mon Sep 17 00:00:00 2001 From: TheEssem Date: Mon, 26 Apr 2021 21:53:27 -0500 Subject: [PATCH] stats.shards isn't a valid field lmao --- app.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index c17667b..a58d0e5 100644 --- a/app.js +++ b/app.js @@ -9,6 +9,7 @@ require("dotenv").config(); const { Master } = require("eris-sharder"); // dbl posting const TopGG = require("@top-gg/sdk"); +const dbl = process.env.NODE_ENV === "production" && process.env.DBL !== "" ? new TopGG.Api(process.env.DBL) : null; const master = new Master(`Bot ${process.env.TOKEN}`, "/shard.js", { name: "esmBot", @@ -45,16 +46,12 @@ const master = new Master(`Bot ${process.env.TOKEN}`, "/shard.js", { } }); -master.on("stats", (stats) => { +master.on("stats", async (stats) => { // dbl posting - if (process.env.NODE_ENV === "production" && process.env.DBL !== "") { - const dbl = new TopGG.Api(process.env.DBL); - - setInterval(() => { - dbl.postStats({ - serverCount: stats.guilds, - shardCount: stats.shards - }); - }, 1800000); + if (dbl) { + await dbl.postStats({ + serverCount: stats.guilds, + shardCount: await master.calculateShards() + }); } }); \ No newline at end of file