Style changes

This commit is contained in:
Daniel Odendahl Jr
2017-10-09 12:52:59 +00:00
parent bf19c9e398
commit c25facec0e
18 changed files with 22 additions and 42 deletions
+1 -2
View File
@@ -18,8 +18,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
async run(msg) {
const pokemon = Math.floor(Math.random() * 721) + 1;
try {
const { body } = await snekfetch
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const { body } = await snekfetch.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const names = body.names.map(name => name.name.toLowerCase());
const displayName = filterPkmn(body.names).name;
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
+1 -2
View File
@@ -44,8 +44,7 @@ module.exports = class MemeCommand extends Command {
async run(msg, { type, top, bottom }) {
try {
const memes = await snekfetch
.get('https://api.imgflip.com/get_memes');
const memes = await snekfetch.get('https://api.imgflip.com/get_memes');
const memeList = memes.body.data.memes;
if (type === 'list') return msg.say(list(memeList.map(meme => meme.name), 'or'), { split: { char: ' ' } });
if (!memeList.some(meme => meme.name.toLowerCase() === type)) {
+1 -2
View File
@@ -22,8 +22,7 @@ module.exports = class RobohashCommand extends Command {
async run(msg, { text }) {
try {
const { body } = await snekfetch
.get(`https://robohash.org/${text}`);
const { body } = await snekfetch.get(`https://robohash.org/${text}`);
return msg.say({ files: [{ attachment: body, name: 'robohash.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -2
View File
@@ -30,8 +30,7 @@ module.exports = class HoroscopeCommand extends Command {
async run(msg, { sign }) {
try {
const { text } = await snekfetch
.get(`http://sandipbgt.com/theastrologer/api/horoscope/${sign}/today/`);
const { text } = await snekfetch.get(`http://sandipbgt.com/theastrologer/api/horoscope/${sign}/today/`);
const body = JSON.parse(text);
const embed = new MessageEmbed()
.setColor(0x9797FF)
+1 -2
View File
@@ -23,8 +23,7 @@ module.exports = class SpoopyLinkCommand extends Command {
async run(msg, { site }) {
if (/discord(\.gg|app\.com%2Finvite|\.me)%2F/gi.test(site)) return msg.say('Discord invites are safe!');
try {
const { body } = await snekfetch
.get(`https://spoopy.link/api/${site}`);
const { body } = await snekfetch.get(`https://spoopy.link/api/${site}`);
return msg.say(stripIndents`
${body.safe ? 'This site is safe!' : 'This site may not be safe...'}
${body.chain.map(url => `<${url.url}> [${url.safe ? 'SAFE' : `UNSAFE: ${url.reasons.join(', ')}`}]`).join('\n')}
+3 -6
View File
@@ -25,8 +25,7 @@ module.exports = class XKCDCommand extends Command {
async run(msg, { type }) {
try {
const current = await snekfetch
.get('https://xkcd.com/info.0.json');
const current = await snekfetch.get('https://xkcd.com/info.0.json');
if (type === 'today') {
const embed = new MessageEmbed()
.setTitle(`${current.body.num} - ${current.body.title}`)
@@ -38,8 +37,7 @@ module.exports = class XKCDCommand extends Command {
}
if (type === 'random') {
const random = Math.floor(Math.random() * current.body.num) + 1;
const { body } = await snekfetch
.get(`https://xkcd.com/${random}/info.0.json`);
const { body } = await snekfetch.get(`https://xkcd.com/${random}/info.0.json`);
const embed = new MessageEmbed()
.setTitle(`${body.num} - ${body.title}`)
.setColor(0x9797FF)
@@ -50,8 +48,7 @@ module.exports = class XKCDCommand extends Command {
}
const choice = parseInt(type, 10);
if (isNaN(choice) || current.body.num < choice || choice < 1) return msg.say('Could not find any results.');
const { body } = await snekfetch
.get(`https://xkcd.com/${choice}/info.0.json`);
const { body } = await snekfetch.get(`https://xkcd.com/${choice}/info.0.json`);
const embed = new MessageEmbed()
.setTitle(`${body.num} - ${body.title}`)
.setColor(0x9797FF)
+1 -2
View File
@@ -15,8 +15,7 @@ module.exports = class CatCommand extends Command {
async run(msg) {
try {
const { body } = await snekfetch
.get('http://random.cat/meow');
const { body } = await snekfetch.get('http://random.cat/meow');
return msg.say({ files: [body.file] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -2
View File
@@ -15,8 +15,7 @@ module.exports = class DogCommand extends Command {
async run(msg) {
try {
const { body } = await snekfetch
.get('https://dog.ceo/api/breeds/image/random');
const { body } = await snekfetch.get('https://dog.ceo/api/breeds/image/random');
return msg.say({ files: [body.message] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -2
View File
@@ -24,8 +24,7 @@ module.exports = class HistoryCommand extends Command {
async run(msg, { date }) {
try {
const { text } = await snekfetch
.get(`http://history.muffinlabs.com/date${date ? `/${date}` : ''}`);
const { text } = await snekfetch.get(`http://history.muffinlabs.com/date${date ? `/${date}` : ''}`);
const body = JSON.parse(text);
const events = body.data.Events;
const event = events[Math.floor(Math.random() * events.length)];
+1 -2
View File
@@ -20,8 +20,7 @@ module.exports = class NumberFactCommand extends Command {
async run(msg, { number }) {
try {
const { text } = await snekfetch
.get(`http://numbersapi.com/${number}`);
const { text } = await snekfetch.get(`http://numbersapi.com/${number}`);
return msg.say(text);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
+1 -2
View File
@@ -13,8 +13,7 @@ module.exports = class QuoteCommand extends Command {
async run(msg) {
try {
const { body } = await snekfetch
.get('https://talaikis.com/api/quotes/random/');
const { body } = await snekfetch.get('https://talaikis.com/api/quotes/random/');
return msg.say(`${body.quote} - _${body.author}_`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -2
View File
@@ -29,8 +29,7 @@ module.exports = class DerpibooruCommand extends Command {
random_image: 1
});
if (!search.body) return msg.say('Could not find any results.');
const { body } = await snekfetch
.get(`https://derpibooru.org/images/${search.body.id}.json`);
const { body } = await snekfetch.get(`https://derpibooru.org/images/${search.body.id}.json`);
return msg.say(stripIndents`
Result for ${query}:
https:${body.representations.medium}
+1 -2
View File
@@ -31,8 +31,7 @@ module.exports = class GitHubCommand extends Command {
async run(msg, { author, repository }) {
try {
const { body } = await snekfetch
.get(`https://${GITHUB_LOGIN}@api.github.com/repos/${author}/${repository}`);
const { body } = await snekfetch.get(`https://${GITHUB_LOGIN}@api.github.com/repos/${author}/${repository}`);
const embed = new MessageEmbed()
.setColor(0xFFFFFF)
.setAuthor('GitHub', 'https://i.imgur.com/e4HunUm.png')
+1 -2
View File
@@ -24,8 +24,7 @@ module.exports = class IPInfoCommand extends Command {
async run(msg, { ip }) {
try {
const { body } = await snekfetch
.get(`https://ipinfo.io/${ip}/json`);
const { body } = await snekfetch.get(`https://ipinfo.io/${ip}/json`);
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setURL(`https://ipinfo.io/${ip}`)
+1 -2
View File
@@ -25,8 +25,7 @@ module.exports = class NPMCommand extends Command {
async run(msg, { query }) {
try {
const { body } = await snekfetch
.get(`https://registry.npmjs.com/${query}`);
const { body } = await snekfetch.get(`https://registry.npmjs.com/${query}`);
const embed = new MessageEmbed()
.setColor(0xCB0000)
.setAuthor('NPM', 'https://i.imgur.com/ErKf5Y0.png')
+1 -2
View File
@@ -26,8 +26,7 @@ module.exports = class PokedexCommand extends Command {
async run(msg, { pokemon }) {
try {
const { body } = await snekfetch
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const { body } = await snekfetch.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
const embed = new MessageEmbed()
.setColor(0xED1C24)
+2 -2
View File
@@ -32,8 +32,8 @@ module.exports = class RottenTomatoesCommand extends Command {
});
if (!search.body.movies.length) return msg.say('Could not find any results.');
const find = search.body.movies.find(m => m.name.toLowerCase() === query.toLowerCase()) || search.body.movies[0];
const { text } = await snekfetch
.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${find.url.replace('/m/', '')}`);
const urlID = find.url.replace('/m/', '');
const { text } = await snekfetch.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`);
const data = JSON.parse(text);
const embed = new MessageEmbed()
.setColor(0xFFEC02)
+2 -4
View File
@@ -24,11 +24,9 @@ module.exports = class YuGiOhCommand extends Command {
async run(msg, { query }) {
try {
const { body } = await snekfetch
.get(`https://yugiohprices.com/api/card_data/${query}`);
const { body } = await snekfetch.get(`https://yugiohprices.com/api/card_data/${query}`);
if (body.status === 'fail') return msg.say('Could not find any results.');
const image = await snekfetch
.get(`https://yugiohprices.com/api/card_image/${query}`, { followRedirects: false });
const image = await snekfetch.get(`https://yugiohprices.com/api/card_image/${query}`, { followRedirects: false });
const { data } = body;
const embed = new MessageEmbed()
.setColor(0xBE5F1F)