Various Fixes and Improvements

This commit is contained in:
Dragon Fire
2021-01-13 17:18:36 -05:00
parent 2061cd77f3
commit 01bc9e7a10
8 changed files with 74 additions and 37 deletions
+2 -2
View File
@@ -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/)

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

+5 -5
View File
@@ -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 class="uabb-infobox-title">(.+)<\/h3>/)[1];
const year = text.match(/<h5 class="uabb-infobox-title-prefix">(.+)<\/h5>/)[1];
const description = text.match(/<div class="uabb-infobox-text uabb-text-editor">.+<p>(.+)<\/p>/)[1]
.replace(/<a href="(.+)" target="_blank" rel="noopener">(.+)<\/a>/, embedURL('$2', '$1'))
.replace(/<em>(.+)<\/em>/i, '_$1_');
const description = text.match(/<div class="uabb-infobox-text uabb-text-editor">(.|\n)+<p>(.+)<\/p>/)[2]
.replace(/<a href="(.+)" target="_blank" rel="noopener">(.+)<\/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!`);
+1 -1
View File
@@ -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;
+58
View File
@@ -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!`);
}
}
};
+7 -1
View File
@@ -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: [
-27
View File
@@ -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')] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "124.6.0",
"version": "125.0.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {