mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
Fix up Carbon/DB POST Requests
This commit is contained in:
@@ -95,10 +95,76 @@ client.on('guildMemberRemove', member => {
|
||||
|
||||
client.on('guildCreate', guild => {
|
||||
console.log("[Guild] I have joined the guild: " + guild.name + " (" + guild.id + ")...");
|
||||
client.shard.fetchClientValues('guilds.size').then(results => {
|
||||
console.log("[POST] " + results);
|
||||
const carbonPOST = {
|
||||
method: 'POST',
|
||||
uri: 'https://www.carbonitex.net/discord/data/botdata.php',
|
||||
body: {
|
||||
key: config.carbonkey,
|
||||
servercount: results
|
||||
},
|
||||
json: true
|
||||
}
|
||||
const DBotsPOST = {
|
||||
method: 'POST',
|
||||
uri: 'https://bots.discord.pw/api/bots/278305350804045834/stats',
|
||||
body: {
|
||||
server_count: results
|
||||
},
|
||||
headers: {
|
||||
'Authorization': config.botskey
|
||||
},
|
||||
json: true
|
||||
}
|
||||
request(carbonPOST).then(function (parsedBody) {
|
||||
console.log('[Carbon] ' + parsedBody);
|
||||
}).catch(function (err) {
|
||||
console.log("[Carbon] " + err);
|
||||
});
|
||||
request(DBotsPOST).then(function (parsedBody) {
|
||||
console.log('[Discord Bots] ' + parsedBody);
|
||||
}).catch(function (err) {
|
||||
console.log("[Discord Bots] " + err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
client.on('guildDelete', guild => {
|
||||
console.log("[Guild] I have left the guild: " + guild.name + " (" + guild.id + ")...");
|
||||
console.log("[POST] " + results);
|
||||
client.shard.fetchClientValues('guilds.size').then(results => {
|
||||
const carbonPOST = {
|
||||
method: 'POST',
|
||||
uri: 'https://www.carbonitex.net/discord/data/botdata.php',
|
||||
body: {
|
||||
key: config.carbonkey,
|
||||
servercount: results
|
||||
},
|
||||
json: true
|
||||
}
|
||||
const DBotsPOST = {
|
||||
method: 'POST',
|
||||
uri: 'https://bots.discord.pw/api/bots/278305350804045834/stats',
|
||||
body: {
|
||||
server_count: results
|
||||
},
|
||||
headers: {
|
||||
'Authorization': config.botskey
|
||||
},
|
||||
json: true
|
||||
}
|
||||
request(carbonPOST).then(function (parsedBody) {
|
||||
console.log('[Carbon] ' + parsedBody);
|
||||
}).catch(function (err) {
|
||||
console.log("[Carbon] " + err);
|
||||
});
|
||||
request(DBotsPOST).then(function (parsedBody) {
|
||||
console.log('[Discord Bots] ' + parsedBody);
|
||||
}).catch(function (err) {
|
||||
console.log("[Discord Bots] " + err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
client.once('ready', () => {
|
||||
|
||||
Reference in New Issue
Block a user