stats.shards isn't a valid field lmao

This commit is contained in:
TheEssem 2021-04-26 21:53:27 -05:00
parent b7fe04c82b
commit 33808685f3

13
app.js
View file

@ -9,6 +9,7 @@ require("dotenv").config();
const { Master } = require("eris-sharder"); const { Master } = require("eris-sharder");
// dbl posting // dbl posting
const TopGG = require("@top-gg/sdk"); 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", { const master = new Master(`Bot ${process.env.TOKEN}`, "/shard.js", {
name: "esmBot", 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 // dbl posting
if (process.env.NODE_ENV === "production" && process.env.DBL !== "") { if (dbl) {
const dbl = new TopGG.Api(process.env.DBL); await dbl.postStats({
setInterval(() => {
dbl.postStats({
serverCount: stats.guilds, serverCount: stats.guilds,
shardCount: stats.shards shardCount: await master.calculateShards()
}); });
}, 1800000);
} }
}); });