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
+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);