mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
poststats changes
This commit is contained in:
@@ -55,14 +55,14 @@ client.on('guildDelete', async(guild) => {
|
||||
console.log(`[Count] ${count}`);
|
||||
webhook(`Left ${guild.name}...\nOwned by: ${guild.owner.user.tag}\nID: ${guild.id}`, `Shard ${client.shard.id}`, 0xFF3300);
|
||||
try {
|
||||
const carbonStats = await carbon(count);
|
||||
console.log(`[Carbon] Successfully posted to Carbon. ${carbonStats}`);
|
||||
await carbon(count);
|
||||
console.log(`[Carbon] Successfully posted to Carbon.`);
|
||||
} catch (err) {
|
||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||
}
|
||||
try {
|
||||
const dbStats = await discordBots(count, client.user.id);
|
||||
console.log(`[Discord Bots] Successfully posted to Discord Bots. ${dbStats}`);
|
||||
await discordBots(count, client.user.id);
|
||||
console.log(`[Discord Bots] Successfully posted to Discord Bots.`);
|
||||
} catch (err) {
|
||||
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "31.9.0",
|
||||
"version": "31.10.0",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
+6
-9
@@ -1,7 +1,7 @@
|
||||
const request = require('superagent');
|
||||
|
||||
module.exports.discordBots = async(count, userID) => {
|
||||
const { body } = await request
|
||||
module.exports.discordBots = (count, userID) => {
|
||||
return request
|
||||
.post(`https://bots.discord.pw/api/bots/${userID}/stats`)
|
||||
.set({
|
||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
||||
@@ -9,20 +9,18 @@ module.exports.discordBots = async(count, userID) => {
|
||||
.send({
|
||||
server_count: count
|
||||
});
|
||||
return body.stats[0].server_count;
|
||||
};
|
||||
|
||||
module.exports.carbon = async(count) => {
|
||||
const { text } = await request
|
||||
module.exports.carbon = (count) => {
|
||||
return request
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: process.env.CARBON_KEY,
|
||||
servercount: count
|
||||
});
|
||||
return text;
|
||||
};
|
||||
|
||||
module.exports.webhook = async(description, author, color) => {
|
||||
module.exports.webhook = (description, author, color) => {
|
||||
const embed = {
|
||||
description: description,
|
||||
author: {
|
||||
@@ -30,10 +28,9 @@ module.exports.webhook = async(description, author, color) => {
|
||||
},
|
||||
color: color
|
||||
};
|
||||
await request
|
||||
return request
|
||||
.post(process.env.LOGGER_URL)
|
||||
.send({
|
||||
embeds: [embed]
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user