From 5c19aa23c36644d4166d3bf43327a9ff1e8ba48f Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 24 Apr 2017 20:48:18 +0000 Subject: [PATCH] poststats changes --- index.js | 8 ++++---- package.json | 2 +- poststats.js | 15 ++++++--------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index a1c15b74..1efd4a84 100644 --- a/index.js +++ b/index.js @@ -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}`); } diff --git a/package.json b/package.json index e2880086..6458f3a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "31.9.0", + "version": "31.10.0", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": { diff --git a/poststats.js b/poststats.js index 86c42002..e863d0f5 100644 --- a/poststats.js +++ b/poststats.js @@ -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; };