diff --git a/.env.example b/.env.example index 46f8022a..62a93240 100644 --- a/.env.example +++ b/.env.example @@ -17,6 +17,7 @@ APRIL_FOOLS= TOP_GG_TOKEN= BOTS_GG_TOKEN= DISCORDBOTLIST_TOKEN= +CARBON_TOKEN= # Redis info REDIS_HOST= diff --git a/Xiao.js b/Xiao.js index e23fdd74..2b117886 100644 --- a/Xiao.js +++ b/Xiao.js @@ -186,10 +186,12 @@ client.on('ready', async () => { await client.postTopGGStats(); await client.postBotsGGStats(); await client.postDiscordBotListStats(); + await client.postCarbonStats(); setInterval(() => { client.postTopGGStats(); client.postBotsGGStats(); client.postDiscordBotListStats(); + client.postCarbonStats(); }, 1.8e+6); }); diff --git a/package.json b/package.json index f42b54a6..0ab9e72b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "134.16.2", + "version": "134.16.3", "description": "Your personal server companion.", "main": "Xiao.js", "private": true, diff --git a/structures/Client.js b/structures/Client.js index 03f5efe5..0a05c573 100644 --- a/structures/Client.js +++ b/structures/Client.js @@ -22,7 +22,8 @@ const { JOIN_LEAVE_CHANNEL_ID, TOP_GG_TOKEN, BOTS_GG_TOKEN, - DISCORDBOTLIST_TOKEN + DISCORDBOTLIST_TOKEN, + CARBON_TOKEN } = process.env; module.exports = class XiaoClient extends CommandoClient { @@ -112,6 +113,23 @@ module.exports = class XiaoClient extends CommandoClient { } } + async postCarbonStats() { + if (!CARBON_TOKEN) return null; + try { + const { body } = await request + .post('https://www.carbonitex.net/discord/data/botdata.php') + .send({ + key: CARBON_TOKEN, + servercount: this.guilds.cache.size + }); + this.logger.info('[CARBON] Posted stats.'); + return body; + } catch (err) { + this.logger.error(`[CARBON] Failed to post stats:\n${err.stack}`); + return err; + } + } + importBlacklist() { const read = fs.readFileSync(path.join(__dirname, '..', 'blacklist.json'), { encoding: 'utf8' }); const file = JSON.parse(read);