mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 22:44:32 +02:00
Add Dependencies and Source Code to info
This commit is contained in:
+14
-3
@@ -1,7 +1,9 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { version } = require('../../package');
|
||||
const { version, dependencies } = require('../../package');
|
||||
const { duration } = require('../../util/Util');
|
||||
const { XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env;
|
||||
const source = XIAO_GITHUB_REPO_NAME && XIAO_GITHUB_REPO_USERNAME;
|
||||
|
||||
module.exports = class InfoCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -24,12 +26,21 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('❯ Shards', this.client.options.shardCount, true)
|
||||
.addField('❯ Commands', this.client.registry.commands.size, true)
|
||||
.addField('❯ Home Server', this.client.options.invite ? `[Here](${this.client.options.invite})` : 'None', true)
|
||||
.addField('❯ Source Code',
|
||||
source ? `[Here](https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME})` : 'N/A', true)
|
||||
.addField('❯ Memory Usage', `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
|
||||
.addField('❯ Uptime', duration(this.client.uptime), true)
|
||||
.addField('❯ Version', `v${version}`, true)
|
||||
.addField('❯ Node Version', process.version, true)
|
||||
.addField('❯ Library',
|
||||
'[discord.js](https://discord.js.org)[-commando](https://github.com/discordjs/Commando)', true);
|
||||
.addField('❯ Dependencies', Object.entries(dependencies).map(dep => this.parseDependency(dep)).join(', '));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
|
||||
parseDependency(dep) {
|
||||
if (dep[1].startsWith('github:')) {
|
||||
const repo = dep[1].replace('github:', '').split('/');
|
||||
return `[${dep[0]}](https://github.com/${repo[0]}/${repo[1].replace(/#.+/, '')})`;
|
||||
}
|
||||
return `[${dep[0]}](https://www.npmjs.com/package/${dep[0]})`;
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "91.5.0",
|
||||
"version": "91.5.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user