Files
xiao/commands/util-public/info.js
T
2024-03-20 21:02:24 -04:00

46 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const Command = require('../../framework/Command');
const { MessageEmbed, version: djsVersion } = require('discord.js');
const moment = require('moment');
require('moment-duration-format');
const { formatNumber, embedURL } = require('../../util/Util');
const { version, dependencies, optionalDependencies } = require('../../package');
const deps = { ...dependencies, ...optionalDependencies };
const copyright = require('../../assets/json/copyright');
module.exports = class InfoCommand extends Command {
constructor(client) {
super(client, {
name: 'info',
aliases: ['stats', 'uptime', 'prefix', 'invite'],
group: 'util-public',
memberName: 'info',
description: 'Responds with detailed bot information.',
guarded: true,
clientPermissions: ['EMBED_LINKS']
});
}
run(msg) {
const invite = this.client.generateInvite({ permissions: ['ADMINISTRATOR'], scopes: ['bot'] });
const prefix = msg.guild ? msg.guild.commandPrefix : this.client.commandPrefix;
const embed = new MessageEmbed()
.setColor(0x00AE86)
.setFooter(copyright.join('\n'))
.addField(' Servers', formatNumber(this.client.guilds.cache.size), true)
.addField(' Commands', formatNumber(this.client.registry.commands.size), true)
.addField(' Shards', formatNumber(this.client.options.shardCount), true)
.addField(' Home Server',
this.client.options.invite ? embedURL('Invite', this.client.options.invite) : 'None', true)
.addField(' Invite', embedURL('Add Me', invite), true)
.addField(' Prefix', prefix || 'None', true)
.addField(' Memory Usage', `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
.addField(' Uptime', moment.duration(this.client.uptime).format('d:hh:mm:ss'), true)
.addField(' Version', `v${version}`, true)
.addField(' Node.js', process.version, true)
.addField(' Discord.js', `v${djsVersion}`, true)
.addField(' Framework', 'Custom', true)
.addField(' Dependencies', Object.keys(deps).sort().join(', '));
return msg.embed(embed);
}
};