diff --git a/README.md b/README.md index 5061176c..04d1ddbe 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Xiao is a Discord bot coded in JavaScript with 7. Run `npm i -g pm2` to install PM2. 8. Run `pm2 start Xiao.js --name xiao` to run the bot. -## Commands (335) +## Commands (332) ### Utility: * **eval:** Executes JavaScript code. @@ -77,7 +77,6 @@ Xiao is a Discord bot coded in JavaScript with * **8-ball:** Asks your question to the Magic 8 Ball. * **advice:** Responds with a random bit of advice. -* **bird:** Responds with a random bird image. * **cat-fact:** Responds with a random cat fact. * **cat:** Responds with a random cat image. * **charlie-charlie:** Asks your question to Charlie. @@ -179,7 +178,6 @@ Xiao is a Discord bot coded in JavaScript with * **imgur:** Searches Imgur for your query. * **itunes:** Searches iTunes for your query. * **jisho:** Defines a word, but with Japanese. -* **kh-wiki:** Searches the Kingdom Hearts Wiki for your query. * **kickstarter:** Searches Kickstarter for your query. * **know-your-meme:** Searches Know Your Meme for your query. * **konachan:** Responds with an image from Konachan, with optional query. @@ -237,7 +235,6 @@ Xiao is a Discord bot coded in JavaScript with * **scrabble-score:** Responds with the scrabble score of a word. * **severe-toxicity:** Determines the toxicity of text, but less sensitive to milder language. * **ship:** Ships two users together. -* **spoopy-link:** Determines if a link is spoopy or not. * **toxicity:** Determines the toxicity of text. * **what-anime:** Determines what anime a screenshot is from. * **zodiac-sign:** Responds with the Zodiac Sign for the given month/day. diff --git a/Xiao.js b/Xiao.js index f3063d02..05c11e07 100644 --- a/Xiao.js +++ b/Xiao.js @@ -7,7 +7,6 @@ const client = new Client({ owner: OWNERS.split(','), invite: INVITE, disableEveryone: true, - unknownCommandResponse: false, disabledEvents: ['TYPING_START'] }); const activities = require('./assets/json/activity'); @@ -36,7 +35,8 @@ client.registry help: false, ping: false, prefix: false, - commandState: false + commandState: false, + unknownCommand: false }) .registerCommandsIn(path.join(__dirname, 'commands')); diff --git a/commands/analyze/spoopy-link.js b/commands/analyze/spoopy-link.js deleted file mode 100644 index 871ea04f..00000000 --- a/commands/analyze/spoopy-link.js +++ /dev/null @@ -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}>` : '❌'; - } -}; diff --git a/commands/random/bird.js b/commands/random/bird.js deleted file mode 100644 index 8d1042cd..00000000 --- a/commands/random/bird.js +++ /dev/null @@ -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!`); - } - } -}; diff --git a/commands/random/fact.js b/commands/random/fact.js index d26969e0..4bc28acc 100644 --- a/commands/random/fact.js +++ b/commands/random/fact.js @@ -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; } }; diff --git a/commands/search/anime.js b/commands/search/anime.js index f75ad76f..317fcd71 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -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(/(
)+/g, '\n')) : 'No description.') .addField('❯ Status', anime.status, true) .addField('❯ Episodes', anime.episodes, true) diff --git a/commands/search/azur-lane.js b/commands/search/azur-lane.js index 195ff6a5..3c724b3b 100644 --- a/commands/search/azur-lane.js +++ b/commands/search/azur-lane.js @@ -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})`); diff --git a/commands/search/book.js b/commands/search/book.js index 7802d750..09ff4761 100644 --- a/commands/search/book.js +++ b/commands/search/book.js @@ -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!`); diff --git a/commands/search/kh-wiki.js b/commands/search/kh-wiki.js deleted file mode 100644 index 11e565cf..00000000 --- a/commands/search/kh-wiki.js +++ /dev/null @@ -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!`); - } - } -}; diff --git a/commands/search/league-of-legends.js b/commands/search/league-of-legends.js index 36fe70de..dc2add47 100644 --- a/commands/search/league-of-legends.js +++ b/commands/search/league-of-legends.js @@ -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.', diff --git a/commands/search/manga.js b/commands/search/manga.js index 6aeab87b..379a7ce4 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -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(/(
)+/g, '\n')) : 'No description.') .addField('❯ Status', manga.status, true) .addField('❯ Chapters / Volumes', `${manga.chapters || '???'}/${manga.volumes || '???'}`, true) diff --git a/package.json b/package.json index c404375b..59de505e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "98.4.1", + "version": "99.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {