mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Display links in all embed URLs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { shorten, base64 } = require('../../util/Util');
|
||||
const { shorten, base64, embedURL } = require('../../util/Util');
|
||||
const { GITHUB_USERNAME, GITHUB_PASSWORD, XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env;
|
||||
|
||||
module.exports = class ChangelogCommand extends Command {
|
||||
@@ -34,7 +34,7 @@ module.exports = class ChangelogCommand extends Command {
|
||||
.setColor(0x7289DA)
|
||||
.setURL(`https://github.com/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}/commits/master`)
|
||||
.setDescription(commits.map(commit => {
|
||||
const hash = `[\`${commit.sha.slice(0, 7)}\`](${commit.html_url})`;
|
||||
const hash = embedURL(`\`${commit.sha.slice(0, 7)}\``, commit.html_url);
|
||||
return `${hash} ${shorten(commit.commit.message.split('\n')[0], 50)} - ${commit.author.login}`;
|
||||
}).join('\n'));
|
||||
return msg.embed(embed);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { embedURL } = require('../../util/Util');
|
||||
|
||||
module.exports = class CreditCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -25,8 +26,8 @@ module.exports = class CreditCommand extends Command {
|
||||
.setTitle(command.name)
|
||||
.setColor(0x7289DA)
|
||||
.setDescription(command.credit.map(credit => {
|
||||
if (!credit.reasonURL) return `[${credit.name}](${credit.url}) (${credit.reason})`;
|
||||
return `[${credit.name}](${credit.url}) ([${credit.reason}](${credit.reasonURL}))`;
|
||||
if (!credit.reasonURL) return `${embedURL(credit.name, credit.url)} (${credit.reason})`;
|
||||
return `${embedURL(credit.name, credit.url)} (${embedURL(credit.reason, credit.reasonURL)})`;
|
||||
}).join('\n'));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
|
||||
@@ -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