|
|
@ -2,7 +2,7 @@ const { Listener } = require('discord-akairo');
|
|
|
|
const akairoVersion = require('discord-akairo').version;
|
|
|
|
const akairoVersion = require('discord-akairo').version;
|
|
|
|
const djsVersion = require('discord.js').version;
|
|
|
|
const djsVersion = require('discord.js').version;
|
|
|
|
const pjson = require('../../package.json');
|
|
|
|
const pjson = require('../../package.json');
|
|
|
|
const { prefix, statsChannel, ownerID, supportServer } = require('../../config.json');
|
|
|
|
const { prefix, statsChannel, ownerID, supportServer, exposeStats } = require('../../config.json');
|
|
|
|
const game = require('../../json/status/playing.json');
|
|
|
|
const game = require('../../json/status/playing.json');
|
|
|
|
const watch = require('../../json/status/watching.json');
|
|
|
|
const watch = require('../../json/status/watching.json');
|
|
|
|
|
|
|
|
|
|
|
@ -73,44 +73,47 @@ class ReadyListener extends Listener {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// Expose stats
|
|
|
|
// Expose stats
|
|
|
|
const port = 3000;
|
|
|
|
if (exposeStats) {
|
|
|
|
|
|
|
|
const port = 3000;
|
|
|
|
|
|
|
|
|
|
|
|
const http = require('http');
|
|
|
|
const http = require('http');
|
|
|
|
|
|
|
|
|
|
|
|
const requestHandler = (req, res) => {
|
|
|
|
const requestHandler = (req, res) => {
|
|
|
|
// Refresh some info
|
|
|
|
// Refresh some info
|
|
|
|
commandSize = this.client.commandHandler.modules.size;
|
|
|
|
commandSize = this.client.commandHandler.modules.size;
|
|
|
|
guildSize = this.client.guilds.size;
|
|
|
|
guildSize = this.client.guilds.size;
|
|
|
|
userSize = this.client.users.size;
|
|
|
|
userSize = this.client.users.size;
|
|
|
|
profilePicture = this.client.user.displayAvatarURL();
|
|
|
|
profilePicture = this.client.user.displayAvatarURL();
|
|
|
|
|
|
|
|
|
|
|
|
let response = {
|
|
|
|
let response = {
|
|
|
|
'commandSize': commandSize,
|
|
|
|
'commandSize': commandSize,
|
|
|
|
'ClientTag': clientTag,
|
|
|
|
'ClientTag': clientTag,
|
|
|
|
'guildSize': guildSize,
|
|
|
|
'guildSize': guildSize,
|
|
|
|
'userSize': userSize,
|
|
|
|
'userSize': userSize,
|
|
|
|
'prefixSize': prefix.length,
|
|
|
|
'prefixSize': prefix.length,
|
|
|
|
'profilePicture': profilePicture,
|
|
|
|
'profilePicture': profilePicture,
|
|
|
|
'clientID': clientID,
|
|
|
|
'clientID': clientID,
|
|
|
|
'djsVersion': djsVersion,
|
|
|
|
'djsVersion': djsVersion,
|
|
|
|
'akairoVersion': akairoVersion,
|
|
|
|
'akairoVersion': akairoVersion,
|
|
|
|
'homepage': pjson.homepage,
|
|
|
|
'homepage': pjson.homepage,
|
|
|
|
'author': author,
|
|
|
|
'author': author,
|
|
|
|
'supportServer': supportServer
|
|
|
|
'supportServer': supportServer
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
res.statusCode = 200;
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/json');
|
|
|
|
|
|
|
|
res.end(JSON.stringify(response));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
res.statusCode = 200;
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/json');
|
|
|
|
const server = http.createServer(requestHandler);
|
|
|
|
res.end(JSON.stringify(response));
|
|
|
|
|
|
|
|
};
|
|
|
|
server.listen(port, (err) => {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
const server = http.createServer(requestHandler);
|
|
|
|
return console.log('something bad happened', err);
|
|
|
|
|
|
|
|
}
|
|
|
|
server.listen(port, (err) => {
|
|
|
|
});
|
|
|
|
if (err) {
|
|
|
|
console.log(`Exposing stats on port ${port}`);
|
|
|
|
return console.log('something bad happened', err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log(`Exposing stats on port ${port}`);
|
|
|
|
|
|
|
|
console.log('===========[ READY ]===========');
|
|
|
|
console.log('===========[ READY ]===========');
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|