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