diff --git a/XiaoBot.js b/XiaoBot.js index 0f8b0453..8010d1fd 100644 --- a/XiaoBot.js +++ b/XiaoBot.js @@ -8,7 +8,7 @@ const client = new CommandoClient({ disableEveryone: true, unknownCommandResponse: false }); -const { carbon, dBots } = require('./structures/Stats'); +const { carbon, dBots } = require('./structures/Util'); client.registry .registerDefaultTypes() diff --git a/structures/Stats.js b/structures/Stats.js deleted file mode 100644 index bc113936..00000000 --- a/structures/Stats.js +++ /dev/null @@ -1,26 +0,0 @@ -const snekfetch = require('snekfetch'); -const { CARBON_KEY, DBOTS_KEY } = process.env; - -class Stats { - static dBots(count, id) { - snekfetch - .post(`https://bots.discord.pw/api/bots/${id}/stats`) - .set({ Authorization: DBOTS_KEY }) - .send({ server_count: count }) - .then(() => console.log('[CARBON] Successfully posted to Carbon.')) - .catch((err) => console.error(`[CARBON] Failed to post to Carbon. ${err}`)); - } - - static carbon(count) { - snekfetch - .post('https://www.carbonitex.net/discord/data/botdata.php') - .send({ - key: CARBON_KEY, - servercount: count - }) - .then(() => console.log('[DBOTS] Successfully posted to Discord Bots.')) - .catch((err) => console.error(`[DBOTS] Failed to post to Discord Bots. ${err}`)); - } -} - -module.exports = Stats; diff --git a/structures/Util.js b/structures/Util.js index 932c634a..86e6ee65 100644 --- a/structures/Util.js +++ b/structures/Util.js @@ -1,3 +1,6 @@ +const snekfetch = require('snekfetch'); +const { CARBON_KEY, DBOTS_KEY } = process.env; + class Util { static cleanXML(str) { return str @@ -8,6 +11,25 @@ class Util { .replace(/(&)/g, '&') .replace(/(\[i\]|\[\/i\])/g, '*'); } + static dBots(count, id) { + snekfetch + .post(`https://bots.discord.pw/api/bots/${id}/stats`) + .set({ Authorization: DBOTS_KEY }) + .send({ server_count: count }) + .then(() => console.log('[CARBON] Successfully posted to Carbon.')) + .catch((err) => console.error(`[CARBON] Failed to post to Carbon. ${err}`)); + } + + static carbon(count) { + snekfetch + .post('https://www.carbonitex.net/discord/data/botdata.php') + .send({ + key: CARBON_KEY, + servercount: count + }) + .then(() => console.log('[DBOTS] Successfully posted to Discord Bots.')) + .catch((err) => console.error(`[DBOTS] Failed to post to Discord Bots. ${err}`)); + } } module.exports = Util;