Haha-Yes/commands/utility/stats.js

30 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2018-09-08 16:10:28 +02:00
const { Command } = require('discord.js-commando');
2018-11-28 01:35:26 +01:00
const SelfReloadJSON = require('self-reload-json');
2018-12-25 19:17:07 +01:00
const blacklist = require('../../json/blacklist.json');
2018-12-05 00:52:21 +01:00
2018-10-01 16:17:33 +02:00
module.exports = class statsCommand extends Command {
2018-09-08 16:10:28 +02:00
constructor(client) {
super(client, {
name: 'stats',
2018-09-16 21:02:11 +02:00
group: 'utility',
2018-09-08 16:10:28 +02:00
memberName: 'stats',
description: 'Show bot stats.',
});
}
2018-09-09 21:32:08 +02:00
async run(message) {
2018-12-06 23:01:40 +01:00
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
2018-11-28 01:35:26 +01:00
if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message)
2018-09-18 01:49:50 +02:00
let totalSeconds = (this.client.uptime / 1000);
2018-09-18 01:52:03 +02:00
let days = Math.floor(totalSeconds / 86400);
2018-09-18 01:49:50 +02:00
let hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60);
let seconds = totalSeconds.toFixed(0) % 60;
2018-09-18 01:52:03 +02:00
let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
2018-09-18 01:49:50 +02:00
return message.channel.send(`Servers: \`${this.client.guilds.size}\`\nChannels: \`${this.client.channels.size}\`\nUsers: \`${this.client.users.size}\`\nBot uptime: \`${uptime}\``);
2018-09-08 16:10:28 +02:00
}
};