diff --git a/README.md b/README.md index 64d0f43e..0d6412c0 100644 --- a/README.md +++ b/README.md @@ -427,7 +427,6 @@ Total: 576 * **its-joke:** It's joke! * **just-do-it:** Sends a link to the "Just Do It!" motivational speech. * **lenny:** Responds with the lenny face. -* **nitro:** Sends an image of a fake nitro giveaway. * **rickroll:** Sends a link to the "Never Gonna Give You Up" music video. * **spam:** Responds with a picture of Spam. * **tableflip:** Flips a table... With animation! @@ -508,6 +507,7 @@ Total: 576 * **paladins:** Responds with information on a Paladins player. * **periodic-table:** Finds an element on the periodic table. * **poem:** Searches for poems by a specific author. +* **pokedex-image:** Responds with the image of a Pokémon. * **pokedex-location:** Responds with the location data for a Pokémon. * **pokedex-moveset:** Responds with the moveset for a Pokémon. * **pokedex:** Searches the Pokédex for a Pokémon. @@ -1787,7 +1787,7 @@ here. - [u/LennyMcLennington](https://www.reddit.com/user/LennyMcLennington) * dark-light ([Image](https://www.reddit.com/r/discordapp/comments/8t04ag/this_image_shows_different_text_depending_on/)) - [u/MoonlightCapital](https://www.reddit.com/user/MoonlightCapital/) - * nitro ([Image](https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/)) + * dark-light ([Image](https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/)) - [u/N1ffler](https://www.reddit.com/user/N1ffler/) * sorting-hat ([Sorting Hat Quiz Analysis Data](https://www.reddit.com/r/Pottermore/comments/44os14/pottermore_sorting_hat_quiz_analysis/)) - [u/PowderedShmegma](https://www.reddit.com/user/PowderedShmegma/) diff --git a/assets/images/nitro.png b/assets/images/dark-light/nitro.png similarity index 100% rename from assets/images/nitro.png rename to assets/images/dark-light/nitro.png diff --git a/commands/events/doomsday-clock.js b/commands/events/doomsday-clock.js index 3433d85c..e4ec29d7 100644 --- a/commands/events/doomsday-clock.js +++ b/commands/events/doomsday-clock.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); +const { decode: decodeHTML } = require('html-entities'); const { MessageEmbed } = require('discord.js'); const { embedURL } = require('../../util/Util'); @@ -23,18 +24,17 @@ module.exports = class DoomsdayClockCommand extends Command { async run(msg) { try { - const { text } = await request.get('https://thebulletin.org/doomsday-clock/past-announcements/'); + const { text } = await request.get('https://thebulletin.org/doomsday-clock/past-statements/'); const time = text.match(/

(.+)<\/h3>/)[1]; const year = text.match(/

(.+)<\/h5>/)[1]; - const description = text.match(/
.+

(.+)<\/p>/)[1] - .replace(/(.+)<\/a>/, embedURL('$2', '$1')) - .replace(/(.+)<\/em>/i, '_$1_'); + const description = text.match(/

(.|\n)+

(.+)<\/p>/)[2] + .replace(/(.+)<\/a>/, embedURL('$2', '$1')); const embed = new MessageEmbed() .setTitle(`${year}: ${time}`) .setColor(0x000000) .setURL('https://thebulletin.org/doomsday-clock/current-time/') .setAuthor('Bulletin of the Atomic Scientists', undefined, 'https://thebulletin.org/') - .setDescription(description); + .setDescription(decodeHTML(description)); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/mayo-clinic.js b/commands/search/mayo-clinic.js index 2bf650e1..f7aceaec 100644 --- a/commands/search/mayo-clinic.js +++ b/commands/search/mayo-clinic.js @@ -66,7 +66,7 @@ module.exports = class MayoClinicCommand extends Command { return { name: $('h1').first().text().trim(), url: location, - description: $('p').eq(1).text().trim() + description: $('p[class="caption"]').first().text().trim() }; } return location; diff --git a/commands/search/pokedex-image.js b/commands/search/pokedex-image.js new file mode 100644 index 00000000..629bac84 --- /dev/null +++ b/commands/search/pokedex-image.js @@ -0,0 +1,58 @@ +const Command = require('../../structures/Command'); + +module.exports = class PokedexImageCommand extends Command { + constructor(client) { + super(client, { + name: 'pokedex-image', + aliases: [ + 'pokemon-image', + 'pokémon-image', + 'pokédex-image', + 'pkmn-image', + 'pokedex-img', + 'pokémon-img', + 'pokemon-img', + 'pokédex-img', + 'pkmn-img' + ], + group: 'search', + memberName: 'pokedex-image', + description: 'Responds with the image of a Pokémon.', + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Pokémon', + url: 'https://www.pokemon.com/us/', + reason: 'Images, Original Game' + }, + { + name: 'PokéAPI', + url: 'https://pokeapi.co/', + reason: 'API' + }, + { + name: 'Serebii.net', + url: 'https://www.serebii.net/index2.shtml', + reason: 'Images' + } + ], + args: [ + { + key: 'pokemon', + prompt: 'What Pokémon would you like to get the image of?', + type: 'string' + } + ] + }); + } + + async run(msg, { pokemon }) { + try { + const data = await this.client.pokemon.fetch(pokemon); + if (!data) return msg.say('Could not find any results.'); + return msg.say(`#${data.displayID} - ${data.name}`, { files: [data.spriteImageURL] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/single/dark-light.js b/commands/single/dark-light.js index 4ae035b8..04c2b341 100644 --- a/commands/single/dark-light.js +++ b/commands/single/dark-light.js @@ -1,7 +1,7 @@ const Command = require('../../structures/Command'); const path = require('path'); const { list } = require('../../util/Util'); -const types = ['default', 'moth', 'jojo', 'spoiler']; +const types = ['default', 'moth', 'jojo', 'spoiler', 'nitro']; module.exports = class DarkLightCommand extends Command { constructor(client) { @@ -30,6 +30,12 @@ module.exports = class DarkLightCommand extends Command { name: 'JoJo\'s Bizzare Adventure', url: 'http://www.araki-jojo.com/', reason: 'Original Anime' + }, + { + name: 'u/MoonlightCapital', + url: 'https://www.reddit.com/user/MoonlightCapital/', + reason: 'Image', + reasonURL: 'https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/' } ], args: [ diff --git a/commands/single/nitro.js b/commands/single/nitro.js deleted file mode 100644 index 02e1245f..00000000 --- a/commands/single/nitro.js +++ /dev/null @@ -1,27 +0,0 @@ -const Command = require('../../structures/Command'); -const path = require('path'); - -module.exports = class NitroCommand extends Command { - constructor(client) { - super(client, { - name: 'nitro', - aliases: ['fake-nitro'], - group: 'single', - memberName: 'nitro', - description: 'Sends an image of a fake nitro giveaway.', - clientPermissions: ['ATTACH_FILES'], - credit: [ - { - name: 'u/MoonlightCapital', - url: 'https://www.reddit.com/user/MoonlightCapital/', - reason: 'Image', - reasonURL: 'https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/' - } - ] - }); - } - - run(msg) { - return msg.say({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'nitro.png')] }); - } -}; diff --git a/package.json b/package.json index 7c20b78c..32b19087 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "124.6.0", + "version": "125.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {