From 95408be3de08259b9537c013ac9fd20ca52adc64 Mon Sep 17 00:00:00 2001 From: dragonfire535 Date: Mon, 6 Mar 2017 07:03:21 -0500 Subject: [PATCH] Add Discord Bots POST --- index.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/index.js b/index.js index 7604ae28..62bcd97b 100644 --- a/index.js +++ b/index.js @@ -104,6 +104,29 @@ client.on('guildCreate', guild => { }).catch(function (err) { console.log("[Carbon] " + err); }); + const DBotsPOST = { + method: 'POST', + uri: 'https://bots.discord.pw/api/bots/:278305350804045834/stats', + body: { + server_count: client.guilds.size + }, + headers: { + 'Authorization': config.botskey + }, + json: true + } + request(carbonPOST).then(function (parsedBody) { + console.log("[Carbon] Carbon POST Succeeded!"); + console.log(parsedBody); + }).catch(function (err) { + console.log("[Carbon] " + err); + }); + request(DBotsPOST).then(function (parsedBody) { + console.log("[Discord Bots] Discord Bots POST Succeeded!"); + console.log(parsedBody); + }).catch(function (err) { + console.log("[Discord Bots] " + err); + }); }); client.on('guildDelete', guild => { @@ -117,11 +140,27 @@ client.on('guildDelete', guild => { }, json: true } + const DBotsPOST = { + method: 'POST', + uri: 'https://bots.discord.pw/api/bots/:278305350804045834/stats', + body: { + server_count: client.guilds.size + }, + headers: { + 'Authorization': config.botskey + }, + json: true + } request(carbonPOST).then(function (parsedBody) { console.log("[Carbon] Carbon POST Succeeded!"); }).catch(function (err) { console.log("[Carbon] " + err); }); + request(DBotsPOST).then(function (parsedBody) { + console.log("[Discord Bots] Discord Bots POST Succeeded!"); + }).catch(function (err) { + console.log("[Discord Bots] " + err); + }); }); client.setInterval(()=>{