poststats changes

This commit is contained in:
Daniel Odendahl Jr
2017-04-24 20:48:18 +00:00
parent 4d0357dd4f
commit 5c19aa23c3
3 changed files with 11 additions and 14 deletions
+4 -4
View File
@@ -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
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "31.9.0",
"version": "31.10.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {
+6 -9
View File
@@ -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;
};