mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Refactor Stats into Util
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
const snekfetch = require('snekfetch');
|
||||
const { CARBON_KEY, DBOTS_KEY } = process.env;
|
||||
|
||||
class Stats {
|
||||
static dBots(count, id) {
|
||||
snekfetch
|
||||
.post(`https://bots.discord.pw/api/bots/${id}/stats`)
|
||||
.set({ Authorization: DBOTS_KEY })
|
||||
.send({ server_count: count })
|
||||
.then(() => console.log('[CARBON] Successfully posted to Carbon.'))
|
||||
.catch((err) => console.error(`[CARBON] Failed to post to Carbon. ${err}`));
|
||||
}
|
||||
|
||||
static carbon(count) {
|
||||
snekfetch
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: CARBON_KEY,
|
||||
servercount: count
|
||||
})
|
||||
.then(() => console.log('[DBOTS] Successfully posted to Discord Bots.'))
|
||||
.catch((err) => console.error(`[DBOTS] Failed to post to Discord Bots. ${err}`));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Stats;
|
||||
@@ -1,3 +1,6 @@
|
||||
const snekfetch = require('snekfetch');
|
||||
const { CARBON_KEY, DBOTS_KEY } = process.env;
|
||||
|
||||
class Util {
|
||||
static cleanXML(str) {
|
||||
return str
|
||||
@@ -8,6 +11,25 @@ class Util {
|
||||
.replace(/(&)/g, '&')
|
||||
.replace(/(\[i\]|\[\/i\])/g, '*');
|
||||
}
|
||||
static dBots(count, id) {
|
||||
snekfetch
|
||||
.post(`https://bots.discord.pw/api/bots/${id}/stats`)
|
||||
.set({ Authorization: DBOTS_KEY })
|
||||
.send({ server_count: count })
|
||||
.then(() => console.log('[CARBON] Successfully posted to Carbon.'))
|
||||
.catch((err) => console.error(`[CARBON] Failed to post to Carbon. ${err}`));
|
||||
}
|
||||
|
||||
static carbon(count) {
|
||||
snekfetch
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: CARBON_KEY,
|
||||
servercount: count
|
||||
})
|
||||
.then(() => console.log('[DBOTS] Successfully posted to Discord Bots.'))
|
||||
.catch((err) => console.error(`[DBOTS] Failed to post to Discord Bots. ${err}`));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;
|
||||
|
||||
Reference in New Issue
Block a user