Add Carbon Stats

This commit is contained in:
Dragon Fire
2021-04-17 18:17:36 -04:00
parent 669fc44ef4
commit 5fc94037be
4 changed files with 23 additions and 2 deletions
+1
View File
@@ -17,6 +17,7 @@ APRIL_FOOLS=
TOP_GG_TOKEN=
BOTS_GG_TOKEN=
DISCORDBOTLIST_TOKEN=
CARBON_TOKEN=
# Redis info
REDIS_HOST=
+2
View File
@@ -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);
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "134.16.2",
"version": "134.16.3",
"description": "Your personal server companion.",
"main": "Xiao.js",
"private": true,
+19 -1
View File
@@ -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);