mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Display links in all embed URLs
This commit is contained in:
@@ -3,7 +3,7 @@ const { MessageEmbed, version: djsVersion } = require('discord.js');
|
||||
const { version: commandoVersion } = require('discord.js-commando');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
const { formatNumber } = require('../../util/Util');
|
||||
const { formatNumber, embedURL } = require('../../util/Util');
|
||||
const { version, dependencies } = require('../../package');
|
||||
const permissions = require('../../assets/json/permissions');
|
||||
const { XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env;
|
||||
@@ -24,16 +24,17 @@ module.exports = class InfoCommand extends Command {
|
||||
|
||||
async run(msg) {
|
||||
const invite = await this.client.generateInvite(permissions);
|
||||
const repoURL = `https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}`;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setFooter('©2017-2020 dragonfire535#8081')
|
||||
.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 ? `[Invite](${this.client.options.invite})` : 'None', true)
|
||||
.addField('❯ Invite', `[Add Me](${invite})`, true)
|
||||
.addField('❯ Source Code',
|
||||
source ? `[GitHub](https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME})` : 'N/A', true)
|
||||
.addField('❯ Home Server',
|
||||
this.client.options.invite ? embedURL('Invite', this.client.options.invite) : 'None', true)
|
||||
.addField('❯ Invite', embedURL('Add Me', invite), true)
|
||||
.addField('❯ Source Code', source ? embedURL('GitHub', repoURL) : 'N/A', 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)
|
||||
@@ -48,9 +49,9 @@ module.exports = class InfoCommand extends Command {
|
||||
return Object.entries(deps).map(dep => {
|
||||
if (dep[1].startsWith('github:')) {
|
||||
const repo = dep[1].replace('github:', '').split('/');
|
||||
return `[${dep[0]}](https://github.com/${repo[0]}/${repo[1].replace(/#(.+)/, '/tree/$1')})`;
|
||||
return embedURL(dep[0], `https://github.com/${repo[0]}/${repo[1].replace(/#(.+)/, '/tree/$1')}`);
|
||||
}
|
||||
return `[${dep[0]}](https://npmjs.com/${dep[0]})`;
|
||||
return embedURL(dep[0], `https://npmjs.com/${dep[0]}`);
|
||||
}).join(', ');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user