mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 22:44:32 +02:00
Add Carbon Stats
This commit is contained in:
+19
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user