1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-22 21:13:18 +00:00

Update botListApi.js

This commit is contained in:
MatteZ02 2020-04-25 18:59:34 +03:00
parent f3fb31466d
commit cfee618ae1

View File

@ -1,14 +1,15 @@
module.exports = function (client) { module.exports = function (client) {
if (client.shard.ids !== 0) return;
const DBL = require("dblapi.js"); const DBL = require("dblapi.js");
const dbl = new DBL(client.config.dblKey, client); const dbl = new DBL(client.config.dblKey, client);
/*const bod_api = require("bodapi.js"); const bod_api = require("bodapi.js");
const bod = new bod_api("Your api token", client);*/ const bod = new bod_api(client.config.bodKey, client);
let guildCount let guildCount;
client.shard client.shard
.broadcastEval("this.guilds.cache.size") .broadcastEval("this.guilds.cache.size")
.then((results) => { .then((results) => {
guildCount = results.reduce((prev, val) => prev + val, 0) guildCount = results.reduce((prev, val) => prev + val, 0);
dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards); dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards);
}) })
.catch(console.error); .catch(console.error);
@ -16,21 +17,34 @@ module.exports = function (client) {
dbl.on("error", (e) => { dbl.on("error", (e) => {
console.log(`DBL error: ${e}`); console.log(`DBL error: ${e}`);
}); });
/*bod.on("error", (e) => { bod.on("posted", (m) => {
console.log(m);
});
bod.on("error", (e) => {
console.log(`BOD error ${e}`); console.log(`BOD error ${e}`);
}); });
const authOptions = { /*const authOptions = {
url: "https://discord.bots.gg/bots/607266889537945605/stats", url: "https://discord.bots.gg/bots/607266889537945605/stats",
headers: { headers: {
Host: "https://discord.bots.gg/api/v1", Host: "https://discord.bots.gg/api/v1",
Authorization: client.config.botListKey, Authorization: client.config.botListKey,
Content - Type: "application/json", Content - Type: "application/json",
{ {
"guildCount": 10 "guildCount": 10
} }
} }
}*/ }*/
setInterval(() => { setInterval(() => {
dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards); dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards);
}, 1800000); }, 1800000);
}; };
const bod_api = require("bodapi.js");
const bod = new bod_api("ApeUyjSHi0tmMYybVwai3PxKvFvq3S", client);
bod.on("posted", (m) => {
console.log(m);
});
bod.on("error", (e) => {
console.log(`BOD error ${e}`);
});