mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add Carbon Stats
This commit is contained in:
@@ -17,6 +17,7 @@ APRIL_FOOLS=
|
||||
TOP_GG_TOKEN=
|
||||
BOTS_GG_TOKEN=
|
||||
DISCORDBOTLIST_TOKEN=
|
||||
CARBON_TOKEN=
|
||||
|
||||
# Redis info
|
||||
REDIS_HOST=
|
||||
|
||||
@@ -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
@@ -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
@@ -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