possible dbl fix?

This commit is contained in:
TheEssem 2021-04-21 13:35:06 -05:00
parent 581518714a
commit 6ed594a177
4 changed files with 25 additions and 55 deletions

20
app.js
View file

@ -5,10 +5,14 @@ The bot will continue to run past this message, but keep in mind that it could b
// load config from .env file // load config from .env file
require("dotenv").config(); require("dotenv").config();
// main sharding manager
const { Master } = require("eris-sharder"); const { Master } = require("eris-sharder");
// dbl posting
const TopGG = require("@top-gg/sdk");
new Master(`Bot ${process.env.TOKEN}`, "/shard.js", { const master = new Master(`Bot ${process.env.TOKEN}`, "/shard.js", {
name: "esmBot", name: "esmBot",
stats: "true",
clientOptions: { clientOptions: {
disableEvents: { disableEvents: {
CHANNEL_DELETE: true, CHANNEL_DELETE: true,
@ -40,3 +44,17 @@ new Master(`Bot ${process.env.TOKEN}`, "/shard.js", {
] ]
} }
}); });
master.on("stats", (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);
}
});

43
package-lock.json generated
View file

@ -1,14 +1,15 @@
{ {
"name": "esmbot", "name": "esmbot",
"version": "1.4.6", "version": "1.5.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "esmbot", "name": "esmbot",
"version": "1.4.6", "version": "1.5.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@top-gg/sdk": "^3.1.1",
"cowsay2": "^2.0.4", "cowsay2": "^2.0.4",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
@ -23,8 +24,7 @@
"node-emoji": "^1.10.0", "node-emoji": "^1.10.0",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"sharp": "^0.26.3", "sharp": "^0.26.3"
"topgg-autoposter": "^1.1.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.13.8", "@babel/eslint-parser": "^7.13.8",
@ -3587,15 +3587,6 @@
"url": "https://github.com/sponsors/Borewit" "url": "https://github.com/sponsors/Borewit"
} }
}, },
"node_modules/topgg-autoposter": {
"version": "1.1.10",
"resolved": "https://registry.npmjs.org/topgg-autoposter/-/topgg-autoposter-1.1.10.tgz",
"integrity": "sha512-VdqHxr1MmxAwilow0PWlVW9fEhKcSqdnRRr+74bd/E4CycQ2eMr6DkrZhnQiFVh1jqr1+DFHxUdRwL/C7IdEHQ==",
"dependencies": {
"@top-gg/sdk": "^3.0.9",
"typescript": "^4.2.3"
}
},
"node_modules/tunnel-agent": { "node_modules/tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -3642,18 +3633,6 @@
"is-typedarray": "^1.0.0" "is-typedarray": "^1.0.0"
} }
}, },
"node_modules/typescript": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/unpipe": { "node_modules/unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@ -6688,15 +6667,6 @@
"ieee754": "^1.2.1" "ieee754": "^1.2.1"
} }
}, },
"topgg-autoposter": {
"version": "1.1.10",
"resolved": "https://registry.npmjs.org/topgg-autoposter/-/topgg-autoposter-1.1.10.tgz",
"integrity": "sha512-VdqHxr1MmxAwilow0PWlVW9fEhKcSqdnRRr+74bd/E4CycQ2eMr6DkrZhnQiFVh1jqr1+DFHxUdRwL/C7IdEHQ==",
"requires": {
"@top-gg/sdk": "^3.0.9",
"typescript": "^4.2.3"
}
},
"tunnel-agent": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -6734,11 +6704,6 @@
"is-typedarray": "^1.0.0" "is-typedarray": "^1.0.0"
} }
}, },
"typescript": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg=="
},
"unpipe": { "unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",

View file

@ -22,6 +22,7 @@
"url": "git+https://github.com/esmBot/esmBot.git" "url": "git+https://github.com/esmBot/esmBot.git"
}, },
"dependencies": { "dependencies": {
"@top-gg/sdk": "^3.1.1",
"cowsay2": "^2.0.4", "cowsay2": "^2.0.4",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
@ -36,8 +37,7 @@
"node-emoji": "^1.10.0", "node-emoji": "^1.10.0",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"sharp": "^0.26.3", "sharp": "^0.26.3"
"topgg-autoposter": "^1.1.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.13.8", "@babel/eslint-parser": "^7.13.8",

View file

@ -12,8 +12,6 @@ const sound = require("./utils/soundplayer.js");
const image = require("./utils/image.js"); const image = require("./utils/image.js");
// database stuff // database stuff
const database = require("./utils/database.js"); const database = require("./utils/database.js");
// dbl posting
const poster = require("topgg-autoposter");
// command collections // command collections
const collections = require("./utils/collections.js"); const collections = require("./utils/collections.js");
// playing messages // playing messages
@ -81,17 +79,6 @@ class Shard extends Base {
require("./utils/database.js").stop(); require("./utils/database.js").stop();
process.exit(0); process.exit(0);
}); });
// dbl posting
if (process.env.NODE_ENV === "production" && process.env.DBL !== "") {
const dbl = poster(process.env.DBL, this.bot);
dbl.on("posted", () => {
logger.log("Posted stats to top.gg");
});
dbl.on("error", e => {
logger.error(e);
});
}
return; return;
} }