Add Blist Stats

This commit is contained in:
Dragon Fire
2021-04-23 12:45:00 -04:00
parent 223ea48ec2
commit ad855b3f29
2 changed files with 18 additions and 1 deletions
+17 -1
View File
@@ -23,7 +23,8 @@ const {
TOP_GG_TOKEN,
BOTS_GG_TOKEN,
DISCORDBOTLIST_TOKEN,
CARBON_TOKEN
CARBON_TOKEN,
BLIST_TOKEN
} = process.env;
module.exports = class XiaoClient extends CommandoClient {
@@ -131,6 +132,21 @@ module.exports = class XiaoClient extends CommandoClient {
}
}
async postBlistStats() {
if (!BLIST_TOKEN) return null;
try {
const { body } = await request
.patch(`https://blist.xyz/api/v2/bot/${this.user.id}/stats/`)
.set({ Authorization: BLIST_TOKEN })
.send({ server_count: this.guilds.cache.size });
this.logger.info('[BLIST] Posted stats.');
return body;
} catch (err) {
this.logger.error(`[BLIST] 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);