This commit is contained in:
Daniel Odendahl Jr
2017-09-27 16:49:37 +00:00
parent 9f1b9688ae
commit 8a70e44902
16 changed files with 88 additions and 18 deletions
+1
View File
@@ -36,6 +36,7 @@ module.exports = class HoroscopeCommand extends Command {
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setTitle(`Horoscope for ${body.sunsign}...`)
.setURL('https://new.theastrologer.com/horoscopes/')
.setTimestamp()
.setDescription(body.horoscope)
.addField(' Mood',
+4 -2
View File
@@ -21,9 +21,11 @@ module.exports = class WordOfTheDayCommand extends Command {
.get('http://api.wordnik.com/v4/words.json/wordOfTheDay')
.query({ api_key: WORDNIK_KEY });
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Wordnik', 'https://i.imgur.com/VcLZLXn.jpg')
.setColor(0xFE6F11)
.setTitle(body.word)
.setDescription(`(${body.definitions[0].partOfSpeech}) ${body.definitions[0].text}`);
.setURL('http://wordnik.com/word-of-the-day')
.setDescription(`(${body.definitions[0].partOfSpeech || 'N/A'}) ${body.definitions[0].text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+8 -1
View File
@@ -27,6 +27,11 @@ module.exports = class BotInfoCommand extends Command {
const { body } = await snekfetch
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
.set({ Authorization: DBOTS_KEY });
const owners = [];
for (const owner of body.owner_ids) {
const user = await this.client.users.fetch(owner);
owners.push(user.tag);
}
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Discord Bots', 'https://i.imgur.com/tHTKaks.jpg')
@@ -38,7 +43,9 @@ module.exports = class BotInfoCommand extends Command {
.addField(' Invite',
`[Here](${body.invite_url})`, true)
.addField(' Prefix',
body.prefix, true);
body.prefix, true)
.addField(' Owner(s)',
owners.join(', '), true);
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
+1
View File
@@ -44,6 +44,7 @@ module.exports = class BulbapediaCommand extends Command {
.setTitle(data.title)
.setAuthor('Bulbapedia', 'https://i.imgur.com/ePpoeFA.png')
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
.setURL(`https://bulbapedia.bulbagarden.net/wiki/${query.replace(/\)/gi, '%29')}`)
.setDescription(shorten(data.extract.replace(/\n/g, '\n\n')));
return msg.embed(embed);
} catch (err) {
+15 -1
View File
@@ -1,5 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { shorten } = require('../../structures/Util');
module.exports = class DerpibooruCommand extends Command {
constructor(client) {
@@ -9,6 +11,7 @@ module.exports = class DerpibooruCommand extends Command {
group: 'search',
memberName: 'derpibooru',
description: 'Searches Derpibooru for your query.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
@@ -33,7 +36,18 @@ module.exports = class DerpibooruCommand extends Command {
if (!msg.channel.nsfw && body.tags.includes('suggestive')) {
return msg.say('This image is only viewable in NSFW channels.');
}
return msg.say(`https:${body.representations.large}`);
const embed = new MessageEmbed()
.setAuthor('Derpibooru', 'https://i.imgur.com/cptnecp.png')
.setColor(0xC6D2E1)
.setURL(`https://derpibooru.org/images/${body.id}`)
.setImage(`https:${body.representations.medium}`)
.addField(' Uploader',
body.uploader, true)
.addField(' Upload Date',
new Date(body.created_at).toDateString(), true)
.addField(' Tags',
shorten(body.tags, 1000));
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+4 -2
View File
@@ -35,9 +35,11 @@ module.exports = class DictionaryCommand extends Command {
if (!body.length) return msg.say('Could not find any results.');
const data = body[0];
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Wordnik', 'https://i.imgur.com/VcLZLXn.jpg')
.setColor(0xFE6F11)
.setTitle(data.word)
.setDescription(`(${data.partOfSpeech}) ${data.text}`);
.setURL(`http://wordnik.com/words/${query}#define`)
.setDescription(`(${data.partOfSpeech || 'N/A'}) ${data.text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+10 -2
View File
@@ -1,4 +1,5 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { FLICKR_KEY } = process.env;
@@ -10,6 +11,7 @@ module.exports = class FlickrCommand extends Command {
group: 'search',
memberName: 'flickr',
description: 'Searches Flickr for your query.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
@@ -32,8 +34,14 @@ module.exports = class FlickrCommand extends Command {
nojsoncallback: true
});
if (!body.photos.photo.length) return msg.say('Could not find any results.');
const photo = body.photos.photo[Math.floor(Math.random() * body.photos.photo.length)];
return msg.say(`https://farm${photo.farm}.staticflickr.com/${photo.server}/${photo.id}_${photo.secret}.jpg`);
const data = body.photos.photo[Math.floor(Math.random() * body.photos.photo.length)];
const embed = new MessageEmbed()
.setAuthor('Flickr', 'https://i.imgur.com/8QPPlV9.png')
.setColor(0x0059D4)
.setImage(`https://farm${data.farm}.staticflickr.com/${data.server}/${data.id}_${data.secret}.jpg`)
.setTitle(data.title)
.setURL(`https://www.flickr.com/photos/${data.owner}/${data.id}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+13 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { GIPHY_KEY } = process.env;
@@ -10,6 +11,7 @@ module.exports = class GiphyCommand extends Command {
group: 'search',
memberName: 'giphy',
description: 'Searches Giphy for your query.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
@@ -30,7 +32,17 @@ module.exports = class GiphyCommand extends Command {
rating: msg.channel.nsfw ? 'r' : 'pg'
});
if (!body.data.length) return msg.say('Could not find any results.');
return msg.say(body.data[Math.floor(Math.random() * body.data.length)].images.original.url);
const data = body.data[Math.floor(Math.random() * body.data.length)];
const embed = new MessageEmbed()
.setAuthor('Giphy', 'https://i.imgur.com/rWphUCU.jpg')
.setColor(0x4C177F)
.setURL(data.url)
.setImage(data.images.original.url.replace(/\?fingerprint=.+/gi, ''))
.addField(' Uploader',
data.username || 'N/A', true)
.addField(' Upload Date',
new Date(data.import_datetime).toDateString(), true);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+3 -1
View File
@@ -29,8 +29,10 @@ module.exports = class JishoCommand extends Command {
if (!body.data.length) return msg.say('Could not find any results.');
const data = body.data[0];
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Jisho', 'https://i.imgur.com/CBJZe2m.png')
.setColor(0x0BC510)
.setTitle(data.japanese[0].word)
.setURL(`http://jisho.org/word/${data.japanese[0].word}`)
.setDescription(data.senses[0].english_definitions.join(', '));
return msg.embed(embed);
} catch (err) {
+1
View File
@@ -30,6 +30,7 @@ module.exports = class RecipeCommand extends Command {
if (!body.results.length) return msg.say('Could not find any results.');
const recipe = body.results[Math.floor(Math.random() * body.results.length)];
const embed = new MessageEmbed()
.setAuthor('Recipe Puppy', 'https://i.imgur.com/mn05Z8y.png')
.setColor(0xC20000)
.setURL(recipe.href)
.setTitle(recipe.title)
+20 -5
View File
@@ -1,7 +1,12 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { xml2js } = require('xml-js');
const { stripIndents } = require('common-tags');
const { shorten } = require('../../structures/Util');
const ratings = {
s: 'Safe',
q: 'Questionable'
};
module.exports = class SafebooruCommand extends Command {
constructor(client) {
@@ -11,6 +16,7 @@ module.exports = class SafebooruCommand extends Command {
group: 'search',
memberName: 'safebooru',
description: 'Searches Safebooru for your query.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
@@ -36,10 +42,19 @@ module.exports = class SafebooruCommand extends Command {
if (parsed._attributes.count === '0' || !parsed.post.length) return msg.say('Could not find any results.');
const posts = msg.channel.nsfw ? parsed.post : parsed.post.filter(post => post._attributes.rating === 's');
if (!posts.length) return msg.say('Could not find any results.');
return msg.say(stripIndents`
${query ? `Results for ${query}:` : 'Random Image:'}
https:${posts[Math.floor(Math.random() * posts.length)]._attributes.file_url}
`);
const data = posts[Math.floor(Math.random() * posts.length)]._attributes;
const embed = new MessageEmbed()
.setAuthor('Safebooru', 'https://i.imgur.com/iGMNwhf.jpg')
.setColor(0xC6D2E1)
.setURL(`http://safebooru.org/index.php?page=post&s=view&id=${data.id}`)
.setImage(`https:${data.file_url}`)
.addField(' Upload Date',
new Date(data.created_at).toDateString(), true)
.addField(' Rating',
ratings[data.rating], true)
.addField(' Tags',
shorten(data.tags, 1000));
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+3 -1
View File
@@ -36,8 +36,10 @@ module.exports = class ThesaurusCommand extends Command {
const synonyms = body.find(i => i.relationshipType === 'synonym');
const antonyms = body.find(i => i.relationshipType === 'antonym');
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Wordnik', 'https://i.imgur.com/VcLZLXn.jpg')
.setColor(0xFE6F11)
.setTitle(query)
.setURL(`http://wordnik.com/words/${query}#relate`)
.addField(' Synonyms',
synonyms ? synonyms.words.join(', ') : 'N/A')
.addField(' Antonyms',
+1
View File
@@ -47,6 +47,7 @@ module.exports = class WeatherCommand extends Command {
const embed = new MessageEmbed()
.setColor(0xFF7A09)
.setAuthor('OpenWeatherMap', 'https://i.imgur.com/tUd1MYB.png')
.setURL(`https://openweathermap.org/city/${body.id}`)
.setThumbnail(body.weather[0].icon ? `http://openweathermap.org/img/w/${body.weather[0].icon}.png` : null)
.setTimestamp()
.addField(' City',
+1
View File
@@ -44,6 +44,7 @@ module.exports = class WikipediaCommand extends Command {
.setTitle(data.title)
.setAuthor('Wikipedia', 'https://i.imgur.com/Z7NJBK2.png')
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
.setURL(`https://en.wikipedia.org/wiki/${query.replace(/\)/gi, '%29')}`)
.setDescription(shorten(data.extract.replace(/\n/g, '\n\n')));
return msg.embed(embed);
} catch (err) {
+2 -1
View File
@@ -67,7 +67,8 @@ module.exports = class TranslateCommand extends Command {
});
const lang = body.lang.split('-');
const embed = new MessageEmbed()
.setColor(0x00AE86)
.setAuthor('Yandex', 'https://i.imgur.com/HMpH9sq.png')
.setColor(0xFF0000)
.addField(` From: ${codes[lang[0]]}`,
text)
.addField(` To: ${codes[lang[1]]}`,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "42.14.0",
"version": "42.14.2",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {