mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add Blist Stats
This commit is contained in:
@@ -18,6 +18,7 @@ TOP_GG_TOKEN=
|
||||
BOTS_GG_TOKEN=
|
||||
DISCORDBOTLIST_TOKEN=
|
||||
CARBON_TOKEN=
|
||||
BLIST_TOKEN=
|
||||
|
||||
# Redis info
|
||||
REDIS_HOST=
|
||||
|
||||
+17
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user