mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Use embedURL when relevant
This commit is contained in:
@@ -4,7 +4,7 @@ const { stripIndents } = require('common-tags');
|
|||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const { decode: decodeHTML } = require('html-entities');
|
const { decode: decodeHTML } = require('html-entities');
|
||||||
const { firstUpperCase } = require('../../util/Util');
|
const { firstUpperCase, embedURL } = require('../../util/Util');
|
||||||
const { months } = require('../../assets/json/month');
|
const { months } = require('../../assets/json/month');
|
||||||
|
|
||||||
module.exports = class FloridaManCommand extends Command {
|
module.exports = class FloridaManCommand extends Command {
|
||||||
@@ -48,7 +48,7 @@ module.exports = class FloridaManCommand extends Command {
|
|||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
**${article.title}**
|
**${article.title}**
|
||||||
${firstUpperCase(months[month - 1])} ${day} — ${article.firstLine}
|
${firstUpperCase(months[month - 1])} ${day} — ${article.firstLine}
|
||||||
[Read more...](<https://floridamanbirthday.org/${months[month - 1]}-${day}>)
|
${embedURL('Read more...', `<https://floridamanbirthday.org/${months[month - 1]}-${day}>`)}
|
||||||
`, { files: [article.image] });
|
`, { files: [article.image] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
|
|
||||||
module.exports = class FirstMessageCommand extends Command {
|
module.exports = class FirstMessageCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -33,7 +34,7 @@ module.exports = class FirstMessageCommand extends Command {
|
|||||||
.setDescription(message.content || 'No content.')
|
.setDescription(message.content || 'No content.')
|
||||||
.setTimestamp(message.createdAt)
|
.setTimestamp(message.createdAt)
|
||||||
.setFooter({ text: `ID: ${message.id}` })
|
.setFooter({ text: `ID: ${message.id}` })
|
||||||
.addField('❯ Jump', `[Click Here to Jump](${message.url})`);
|
.addField('❯ Jump', embedURL('Click Here to Jump', message.url));
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
const genGames = [null, 'rb', 'gs', 'rs', 'dp', 'bw', 'xy', 'sm', 'ss', 'sv'];
|
const genGames = [null, 'rb', 'gs', 'rs', 'dp', 'bw', 'xy', 'sm', 'ss', 'sv'];
|
||||||
const games = {
|
const games = {
|
||||||
rb: 'Red/Blue',
|
rb: 'Red/Blue',
|
||||||
@@ -71,7 +72,8 @@ module.exports = class SmogonCommand extends Command {
|
|||||||
})
|
})
|
||||||
.setThumbnail(pokemon.spriteImageURL);
|
.setThumbnail(pokemon.spriteImageURL);
|
||||||
for (const game of fetchGames) {
|
for (const game of fetchGames) {
|
||||||
embed.addField(`❯ ${games[game]}`, `[${pokemon.smogonTiers[game].join('/')}](${pokemon.smogonURL(game)})`, true);
|
const tiers = pokemon.smogonTiers[game];
|
||||||
|
embed.addField(`❯ ${games[game]}`, embedURL(tiers.join('/'), pokemon.smogonURL(game)), true);
|
||||||
}
|
}
|
||||||
if (fetchGames.length % 3 !== 0 && fetchGames.length > 3) {
|
if (fetchGames.length % 3 !== 0 && fetchGames.length > 3) {
|
||||||
for (let i = 0; i < 3 - (fetchGames.length % 3); i++) {
|
for (let i = 0; i < 3 - (fetchGames.length % 3); i++) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { PermissionFlagsBits } = require('discord.js');
|
const { PermissionFlagsBits } = require('discord.js');
|
||||||
const sagiri = require('sagiri');
|
const sagiri = require('sagiri');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
const { SAUCENAO_KEY } = process.env;
|
const { SAUCENAO_KEY } = process.env;
|
||||||
const sagiriClient = sagiri(SAUCENAO_KEY);
|
const sagiriClient = sagiri(SAUCENAO_KEY);
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@@ -58,7 +59,9 @@ module.exports = class XiaoCommand extends Command {
|
|||||||
if (data && data[0].similarity > 90) {
|
if (data && data[0].similarity > 90) {
|
||||||
result = '';
|
result = '';
|
||||||
const sauce = data[0];
|
const sauce = data[0];
|
||||||
if (sauce.authorName && sauce.authorUrl) result += `Art by [${sauce.authorName}](<${sauce.authorUrl}>) | `;
|
if (sauce.authorName && sauce.authorUrl) {
|
||||||
|
result += `Art by ${embedURL(sauce.authorName, `<${sauce.authorUrl}>`)} | `;
|
||||||
|
}
|
||||||
if (sauce.authorName && !sauce.authorUrl) result += `Art by ${sauce.authorName} | `;
|
if (sauce.authorName && !sauce.authorUrl) result += `Art by ${sauce.authorName} | `;
|
||||||
result += `Art Source: <${sauce.url}>`;
|
result += `Art Source: <${sauce.url}>`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ module.exports = class AnimeCommand extends Command {
|
|||||||
.addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true)
|
.addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true)
|
||||||
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true)
|
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true)
|
||||||
.addField('❯ External Links', anime.externalLinks.length
|
.addField('❯ External Links', anime.externalLinks.length
|
||||||
? anime.externalLinks.map(link => `[${link.site}](${link.url})`).join(', ')
|
? anime.externalLinks.map(link => embedURL(link.site, link.url)).join(', ')
|
||||||
: 'None');
|
: 'None');
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
|
|||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndents } = require('common-tags');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
const logos = require('../../assets/json/logos');
|
const logos = require('../../assets/json/logos');
|
||||||
|
|
||||||
module.exports = class MagicCommand extends Command {
|
module.exports = class MagicCommand extends Command {
|
||||||
@@ -75,8 +76,8 @@ module.exports = class MagicCommand extends Command {
|
|||||||
embed.addField('❯ Loyalty', card.loyalty);
|
embed.addField('❯ Loyalty', card.loyalty);
|
||||||
}
|
}
|
||||||
embed.addField('❯ Price', stripIndents`
|
embed.addField('❯ Price', stripIndents`
|
||||||
**Non-Foil:** [${card.prices.usd ? `$${card.prices.usd}` : '???'}](${card.purchase_uris.tcgplayer})
|
**Non-Foil:** ${embedURL(card.prices.usd ? `$${card.prices.usd}` : '???', card.purchase_uris.tcgplayer)}
|
||||||
**Foil:** [${card.prices.usd_foil ? `$${card.prices.usd_foil}` : '???'}](${card.purchase_uris.tcgplayer})
|
**Foil:** ${embedURL(card.prices.usd_foil ? `$${card.prices.usd_foil}` : '???', card.purchase_uris.tcgplayer)}
|
||||||
`);
|
`);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ module.exports = class MangaCommand extends Command {
|
|||||||
.addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true)
|
.addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true)
|
||||||
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true)
|
.addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true)
|
||||||
.addField('❯ External Links', manga.externalLinks.length
|
.addField('❯ External Links', manga.externalLinks.length
|
||||||
? manga.externalLinks.map(link => `[${link.site}](${link.url})`).join(', ')
|
? manga.externalLinks.map(link => embedURL(link.site, link.url)).join(', ')
|
||||||
: 'None');
|
: 'None');
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
const logos = require('../../assets/json/logos');
|
const logos = require('../../assets/json/logos');
|
||||||
|
|
||||||
module.exports = class WikipediaCommand extends Command {
|
module.exports = class WikipediaCommand extends Command {
|
||||||
@@ -67,7 +68,7 @@ module.exports = class WikipediaCommand extends Command {
|
|||||||
fact += ' ';
|
fact += ' ';
|
||||||
}
|
}
|
||||||
const url = `https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`;
|
const url = `https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`;
|
||||||
fact += `[Read more...](${url})`;
|
face += embedURL('Read more...', url);
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(0xE7E7E7)
|
.setColor(0xE7E7E7)
|
||||||
.setTitle(data.title)
|
.setTitle(data.title)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
|
const { embedURL } = require('../../util/Util');
|
||||||
const { dependencies, optionalDependencies } = require('../../package');
|
const { dependencies, optionalDependencies } = require('../../package');
|
||||||
const deps = Object.keys({ ...dependencies, ...optionalDependencies }).sort();
|
const deps = Object.keys({ ...dependencies, ...optionalDependencies }).sort();
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ module.exports = class GenerateCreditCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
const npm = `* ${deps.map(dep => `[${dep}](https://www.npmjs.com/package/${dep})`).join('\n* ')}`;
|
const npm = `* ${deps.map(dep => embedURL(dep, `https://www.npmjs.com/package/${dep}`)).join('\n* ')}`;
|
||||||
const list = this.client.registry.groups
|
const list = this.client.registry.groups
|
||||||
.map(g => {
|
.map(g => {
|
||||||
const commands = g.commands
|
const commands = g.commands
|
||||||
@@ -28,8 +29,8 @@ module.exports = class GenerateCreditCommand extends Command {
|
|||||||
const credits = c.credit
|
const credits = c.credit
|
||||||
.filter(cred => cred.name !== 'Dragon Fire')
|
.filter(cred => cred.name !== 'Dragon Fire')
|
||||||
.map(cred => {
|
.map(cred => {
|
||||||
const reason = cred.reasonURL ? `[${cred.reason}](${cred.reasonURL})` : cred.reason;
|
const reason = cred.reasonURL ? embedURL(cred.reason, cred.reasonURL) : cred.reason;
|
||||||
return `[${cred.name}](${cred.url}) (${reason})`;
|
return `${embedURL(cred.name, cred.url)} (${reason})`;
|
||||||
});
|
});
|
||||||
return `* **${c.name}:**\n - ${credits.join('\n - ')}`;
|
return `* **${c.name}:**\n - ${credits.join('\n - ')}`;
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user