From 8a70e44902bb4d10ad3c8deca186a5eeccce37a6 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 27 Sep 2017 16:49:37 +0000 Subject: [PATCH] LOGOS :( --- commands/random/horoscope.js | 1 + commands/random/word-of-the-day.js | 6 ++++-- commands/search/bot-info.js | 9 ++++++++- commands/search/bulbapedia.js | 1 + commands/search/derpibooru.js | 16 +++++++++++++++- commands/search/dictionary.js | 6 ++++-- commands/search/flickr.js | 12 ++++++++++-- commands/search/giphy.js | 14 +++++++++++++- commands/search/jisho.js | 4 +++- commands/search/recipe.js | 1 + commands/search/safebooru.js | 25 ++++++++++++++++++++----- commands/search/thesaurus.js | 4 +++- commands/search/weather.js | 1 + commands/search/wikipedia.js | 1 + commands/text-edit/translate.js | 3 ++- package.json | 2 +- 16 files changed, 88 insertions(+), 18 deletions(-) diff --git a/commands/random/horoscope.js b/commands/random/horoscope.js index 02e80931..ff177efe 100644 --- a/commands/random/horoscope.js +++ b/commands/random/horoscope.js @@ -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', diff --git a/commands/random/word-of-the-day.js b/commands/random/word-of-the-day.js index 02bf07f3..bdf397de 100644 --- a/commands/random/word-of-the-day.js +++ b/commands/random/word-of-the-day.js @@ -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!`); diff --git a/commands/search/bot-info.js b/commands/search/bot-info.js index b8780c74..2e21b3df 100644 --- a/commands/search/bot-info.js +++ b/commands/search/bot-info.js @@ -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.'); diff --git a/commands/search/bulbapedia.js b/commands/search/bulbapedia.js index 60805c2a..c9fb13aa 100644 --- a/commands/search/bulbapedia.js +++ b/commands/search/bulbapedia.js @@ -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) { diff --git a/commands/search/derpibooru.js b/commands/search/derpibooru.js index e77637fa..43cf9ff7 100644 --- a/commands/search/derpibooru.js +++ b/commands/search/derpibooru.js @@ -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!`); } diff --git a/commands/search/dictionary.js b/commands/search/dictionary.js index 18038fb8..0d27d4c3 100644 --- a/commands/search/dictionary.js +++ b/commands/search/dictionary.js @@ -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!`); diff --git a/commands/search/flickr.js b/commands/search/flickr.js index c43df31f..07282ab9 100644 --- a/commands/search/flickr.js +++ b/commands/search/flickr.js @@ -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!`); } diff --git a/commands/search/giphy.js b/commands/search/giphy.js index 503e7ac1..7e35ce72 100644 --- a/commands/search/giphy.js +++ b/commands/search/giphy.js @@ -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!`); } diff --git a/commands/search/jisho.js b/commands/search/jisho.js index 344be492..74500340 100644 --- a/commands/search/jisho.js +++ b/commands/search/jisho.js @@ -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) { diff --git a/commands/search/recipe.js b/commands/search/recipe.js index 85f0a3a1..1ce00651 100644 --- a/commands/search/recipe.js +++ b/commands/search/recipe.js @@ -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) diff --git a/commands/search/safebooru.js b/commands/search/safebooru.js index 5a84e545..a9162b03 100644 --- a/commands/search/safebooru.js +++ b/commands/search/safebooru.js @@ -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!`); } diff --git a/commands/search/thesaurus.js b/commands/search/thesaurus.js index 69f81e10..b03d1e47 100644 --- a/commands/search/thesaurus.js +++ b/commands/search/thesaurus.js @@ -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', diff --git a/commands/search/weather.js b/commands/search/weather.js index 02273f59..1b574a46 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -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', diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index d0f3ba26..71285880 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -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) { diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js index aa0ab93a..75543dfc 100644 --- a/commands/text-edit/translate.js +++ b/commands/text-edit/translate.js @@ -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]]}`, diff --git a/package.json b/package.json index eb1552af..ce7e038a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.14.0", + "version": "42.14.2", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {