mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 15:57:50 +02:00
Remove commands that no longer work, fix others
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { FAILURE_EMOJI_ID, FAILURE_EMOJI_NAME, SUCCESS_EMOJI_ID, SUCCESS_EMOJI_NAME } = process.env;
|
||||
|
||||
module.exports = class SpoopyLinkCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'spoopy-link',
|
||||
group: 'analyze',
|
||||
memberName: 'spoopy-link',
|
||||
description: 'Determines if a link is spoopy or not.',
|
||||
args: [
|
||||
{
|
||||
key: 'site',
|
||||
prompt: 'What site do you think is spoopy?',
|
||||
type: 'string',
|
||||
parse: site => encodeURIComponent(site)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { site }) {
|
||||
try {
|
||||
const { body } = await request.get(`https://spoopy.link/api/${site}`);
|
||||
const chain = body.chain.map(
|
||||
url => `<${url.url}> ${url.safe ? this.successEmoji : `${this.failureEmoji} (${url.reasons.join(', ')})`}`
|
||||
);
|
||||
return msg.say(stripIndents`
|
||||
${body.safe ? 'Safe!' : 'Not safe...'}
|
||||
${chain.join('\n')}
|
||||
`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
get successEmoji() {
|
||||
return SUCCESS_EMOJI_ID && SUCCESS_EMOJI_NAME ? `<:${SUCCESS_EMOJI_NAME}:${SUCCESS_EMOJI_ID}>` : '✅';
|
||||
}
|
||||
|
||||
get failureEmoji() {
|
||||
return FAILURE_EMOJI_ID && FAILURE_EMOJI_NAME ? `<:${FAILURE_EMOJI_NAME}:${FAILURE_EMOJI_ID}>` : '❌';
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class BirdCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bird',
|
||||
aliases: ['birb'],
|
||||
group: 'random',
|
||||
memberName: 'bird',
|
||||
description: 'Responds with a random bird image.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { text } = await request.get('http://random.birb.pw/tweet.json/');
|
||||
return msg.say({ files: [`https://random.birb.pw/img/${JSON.parse(text).file}`] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -49,6 +49,7 @@ module.exports = class FactCommand extends Command {
|
||||
format: 'json',
|
||||
formatversion: 2
|
||||
});
|
||||
if (!body.query.random[0].title) return 'Facts are hard to find sometimes.';
|
||||
return body.query.random[0].title;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ module.exports = class AnimeCommand extends Command {
|
||||
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
|
||||
.setURL(`https://anilist.co/anime/${anime.id}`)
|
||||
.setThumbnail(anime.coverImage.large || null)
|
||||
.setTitle(anime.title.userPreferred)
|
||||
.setTitle(anime.title.english || anime.title.userPreferred)
|
||||
.setDescription(anime.description ? shorten(anime.description.replace(/(<br>)+/g, '\n')) : 'No description.')
|
||||
.addField('❯ Status', anime.status, true)
|
||||
.addField('❯ Episodes', anime.episodes, true)
|
||||
|
||||
@@ -52,9 +52,9 @@ module.exports = class AzurLaneCommand extends Command {
|
||||
.addField('❯ Aviation', `${formatNumber(data.base.air_power)} (${formatNumber(data.max.air_power)} Max)`, true)
|
||||
.addField('❯ Oil Cost', `${formatNumber(data.base.oil_usage)} (${formatNumber(data.max.oil_usage)} Max)`, true)
|
||||
.addField('❯ Equipment', stripIndents`
|
||||
${data.equipment[0].equippable} (${data.equipment[0].efficiency})
|
||||
${data.equipment[1].equippable} (${data.equipment[1].efficiency})
|
||||
${data.equipment[2].equippable} (${data.equipment[2].efficiency})
|
||||
${data.equipment[0].equipable} (${data.equipment[0].efficiency})
|
||||
${data.equipment[1].equipable} (${data.equipment[1].efficiency})
|
||||
${data.equipment[2].equipable} (${data.equipment[2].efficiency})
|
||||
`)
|
||||
.addField('❯ Images',
|
||||
`${data.images.map(img => `[${img.name}](${img.url})`).join(', ')}, [Chibi](${data.chibi})`);
|
||||
|
||||
@@ -44,8 +44,7 @@ module.exports = class BookCommand extends Command {
|
||||
.setThumbnail(data.imageLinks ? data.imageLinks.thumbnail : null)
|
||||
.addField('❯ Authors', data.authors.length ? data.authors.join(', ') : '???')
|
||||
.addField('❯ Publish Date', data.publishedDate || '???', true)
|
||||
.addField('❯ Page Count', data.pageCount ? formatNumber(data.pageCount) : '???', true)
|
||||
.addField('❯ Genres', data.categories.length ? data.categories.join(', ') : '???');
|
||||
.addField('❯ Page Count', data.pageCount ? formatNumber(data.pageCount) : '???', true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { shorten } = require('../../util/Util');
|
||||
|
||||
module.exports = class KhWikiCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kh-wiki',
|
||||
aliases: ['kingdom-hearts-wiki'],
|
||||
group: 'search',
|
||||
memberName: 'kh-wiki',
|
||||
description: 'Searches the Kingdom Hearts Wiki for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What article would you like to search for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('https://www.khwiki.com/api.php')
|
||||
.query({
|
||||
action: 'query',
|
||||
prop: 'extracts|pageimages',
|
||||
format: 'json',
|
||||
titles: query,
|
||||
exintro: '',
|
||||
explaintext: '',
|
||||
pithumbsize: 150,
|
||||
redirects: '',
|
||||
formatversion: 2
|
||||
});
|
||||
const data = body.query.pages[0];
|
||||
if (data.missing) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x0679BC)
|
||||
.setTitle(data.title)
|
||||
.setAuthor('Kingdom Hearts Wiki', 'https://i.imgur.com/OZhrA41.jpg', 'https://www.khwiki.com/')
|
||||
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
|
||||
.setURL(`https://www.khwiki.com/${encodeURIComponent(query).replace(/\)/g, '%29')}`)
|
||||
.setDescription(shorten(data.extract.replace(/.+\n\n/, '').replace(/\n/g, '\n\n')));
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -7,7 +7,7 @@ module.exports = class LeagueOfLegendsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'league-of-legends',
|
||||
aliases: ['league-of-legends-champion', 'league-of-legends-champ', 'league-champ'],
|
||||
aliases: ['league-of-legends-champion', 'league-of-legends-champ', 'league-champ', 'lol-champ'],
|
||||
group: 'search',
|
||||
memberName: 'league-of-legends',
|
||||
description: 'Responds with information on a League of Legends champion.',
|
||||
|
||||
@@ -57,7 +57,7 @@ module.exports = class MangaCommand extends Command {
|
||||
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
|
||||
.setURL(`https://anilist.co/manga/${manga.id}`)
|
||||
.setThumbnail(manga.coverImage.large || null)
|
||||
.setTitle(manga.title.userPreferred)
|
||||
.setTitle(manga.title.english || manga.title.userPreferred)
|
||||
.setDescription(manga.description ? shorten(manga.description.replace(/(<br>)+/g, '\n')) : 'No description.')
|
||||
.addField('❯ Status', manga.status, true)
|
||||
.addField('❯ Chapters / Volumes', `${manga.chapters || '???'}/${manga.volumes || '???'}`, true)
|
||||
|
||||
Reference in New Issue
Block a user