From f3fb31466db34d53b325105053378f31a15da480 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Sat, 25 Apr 2020 12:56:13 +0300 Subject: [PATCH] fix --- src/struct/config/config.js | 1 + src/struct/funcs/botListApi.js | 43 +++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/struct/config/config.js b/src/struct/config/config.js index fc1004ee..96035946 100644 --- a/src/struct/config/config.js +++ b/src/struct/config/config.js @@ -4,6 +4,7 @@ module.exports = { token: process.env.TOKEN, devToken: process.env.DEVTOKEN, dblKey: process.env.DBLKEY, + bodKey: process.env.BODKEY, api_key: process.env.GOOGLE_API_KEY, genius_api_key: process.env.GENIUS_API_KEY, soundCloud_api_key: process.env.SOUNDCLOUD_API_KEY, diff --git a/src/struct/funcs/botListApi.js b/src/struct/funcs/botListApi.js index 984c3868..5dfe028f 100644 --- a/src/struct/funcs/botListApi.js +++ b/src/struct/funcs/botListApi.js @@ -1,31 +1,36 @@ module.exports = function (client) { const DBL = require("dblapi.js"); const dbl = new DBL(client.config.dblKey, client); - const bod_api = require("bodapi.js"); - const bod = new bod_api("Your api token", client); + /*const bod_api = require("bodapi.js"); + const bod = new bod_api("Your api token", client);*/ + let guildCount + + client.shard + .broadcastEval("this.guilds.cache.size") + .then((results) => { + guildCount = results.reduce((prev, val) => prev + val, 0) + dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards); + }) + .catch(console.error); dbl.on("error", (e) => { console.log(`DBL error: ${e}`); }); - bod.on("error", (e) => { + /*bod.on("error", (e) => { console.log(`BOD error ${e}`); }); - /*const authOptions = { - url: "https://discord.bots.gg/bots/607266889537945605/stats", - headers: { - Host: "https://discord.bots.gg/api/v1", - Authorization: client.config.botListKey, - Content - Type: "application/json", - { - "guildCount": 10 - } - } - }*/ + const authOptions = { + url: "https://discord.bots.gg/bots/607266889537945605/stats", + headers: { + Host: "https://discord.bots.gg/api/v1", + Authorization: client.config.botListKey, + Content - Type: "application/json", + { + "guildCount": 10 + } + } + }*/ setInterval(() => { - dbl.postStats( - client.guilds.cache.size, - client.shard.ids, - client.config.shards - ); + dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards); }, 1800000); }; \ No newline at end of file