From 116582e6a856a1b6e390f40cd9f0e893386b30b7 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 20 Apr 2018 13:15:38 +0000 Subject: [PATCH] Embed style, better yugioh api --- commands/events/horoscope.js | 9 ++-- commands/info/channel.js | 21 +++----- commands/info/emoji.js | 12 ++--- commands/info/role.js | 21 +++----- commands/info/server.js | 30 ++++------- commands/info/user.js | 21 +++----- commands/random/new-york-times.js | 3 +- commands/search/forecast.js | 11 ++-- commands/search/github.js | 18 +++---- commands/search/google-book.js | 12 ++--- commands/search/itunes.js | 12 ++--- commands/search/kickstarter.js | 18 +++---- commands/search/league-of-legends-champion.js | 51 +++++++------------ commands/search/my-anime-list-anime.js | 12 ++--- commands/search/my-anime-list-manga.js | 9 ++-- commands/search/neopets-item.js | 3 +- commands/search/npm.js | 24 +++------ commands/search/osu.js | 36 +++++-------- commands/search/rotten-tomatoes.js | 6 +-- commands/search/stack-overflow.js | 18 +++---- commands/search/steam.js | 24 +++------ commands/search/stocks.js | 18 +++---- commands/search/tmdb-movie.js | 9 ++-- commands/search/tmdb-tv-show.js | 15 ++---- commands/search/tumblr.js | 6 +-- commands/search/twitter.js | 21 +++----- commands/search/urban-dictionary.js | 3 +- commands/search/vocaloid.js | 6 +-- commands/search/wattpad.js | 18 +++---- commands/search/weather.js | 36 +++++-------- commands/search/youtube.js | 9 ++-- commands/search/yu-gi-oh.js | 47 ++++++++--------- commands/text-edit/translate.js | 6 +-- commands/util/info.js | 24 +++------ package.json | 2 +- 35 files changed, 207 insertions(+), 384 deletions(-) diff --git a/commands/events/horoscope.js b/commands/events/horoscope.js index 6259eb5c..c9efe470 100644 --- a/commands/events/horoscope.js +++ b/commands/events/horoscope.js @@ -34,12 +34,9 @@ module.exports = class HoroscopeCommand extends Command { .setURL(`https://new.theastrologer.com/${body.sunsign}/`) .setTimestamp() .setDescription(body.horoscope) - .addField('❯ Mood', - body.meta.mood, true) - .addField('❯ Intensity', - body.meta.intensity, true) - .addField('❯ Date', - body.date, true); + .addField('❯ Mood', body.meta.mood, true) + .addField('❯ Intensity', body.meta.intensity, true) + .addField('❯ Date', body.date, true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/info/channel.js b/commands/info/channel.js index 09f8160b..c21a8b98 100644 --- a/commands/info/channel.js +++ b/commands/info/channel.js @@ -32,20 +32,13 @@ module.exports = class ChannelInfoCommand extends Command { run(msg, { channel }) { const embed = new MessageEmbed() .setColor(0x00AE86) - .addField('❯ Name', - channel.type === 'dm' ? `@${channel.recipient.username}` : channel.name, true) - .addField('❯ ID', - channel.id, true) - .addField('❯ NSFW', - channel.nsfw ? 'Yes' : 'No', true) - .addField('❯ Category', - channel.parent ? channel.parent.name : 'None', true) - .addField('❯ Type', - types[channel.type], true) - .addField('❯ Creation Date', - channel.createdAt.toDateString(), true) - .addField('❯ Topic', - channel.topic || 'None'); + .addField('❯ Name', channel.type === 'dm' ? `@${channel.recipient.username}` : channel.name, true) + .addField('❯ ID', channel.id, true) + .addField('❯ NSFW', channel.nsfw ? 'Yes' : 'No', true) + .addField('❯ Category', channel.parent ? channel.parent.name : 'None', true) + .addField('❯ Type', types[channel.type], true) + .addField('❯ Creation Date', channel.createdAt.toDateString(), true) + .addField('❯ Topic', channel.topic || 'None'); return msg.embed(embed); } }; diff --git a/commands/info/emoji.js b/commands/info/emoji.js index 24ee0164..e19bd26f 100644 --- a/commands/info/emoji.js +++ b/commands/info/emoji.js @@ -25,14 +25,10 @@ module.exports = class EmojiInfoCommand extends Command { const embed = new MessageEmbed() .setColor(0x00AE86) .setThumbnail(emoji.url) - .addField('❯ Name', - emoji.name, true) - .addField('❯ ID', - emoji.id, true) - .addField('❯ Creation Date', - emoji.createdAt.toDateString(), true) - .addField('❯ Animated?', - emoji.animated ? 'Yes' : 'No', true); + .addField('❯ Name', emoji.name, true) + .addField('❯ ID', emoji.id, true) + .addField('❯ Creation Date', emoji.createdAt.toDateString(), true) + .addField('❯ Animated?', emoji.animated ? 'Yes' : 'No', true); return msg.embed(embed); } }; diff --git a/commands/info/role.js b/commands/info/role.js index b0baf064..3db86c2a 100644 --- a/commands/info/role.js +++ b/commands/info/role.js @@ -27,20 +27,13 @@ module.exports = class RoleInfoCommand extends Command { const perms = Object.keys(permissions).filter(perm => serialized[perm]); const embed = new MessageEmbed() .setColor(role.hexColor) - .addField('❯ Name', - role.name, true) - .addField('❯ ID', - role.id, true) - .addField('❯ Color', - role.hexColor.toUpperCase(), true) - .addField('❯ Creation Date', - role.createdAt.toDateString(), true) - .addField('❯ Hoisted?', - role.hoist ? 'Yes' : 'No', true) - .addField('❯ Mentionable?', - role.mentionable ? 'Yes' : 'No', true) - .addField('❯ Permissions', - perms.map(perm => permissions[perm]).join(', ') || 'None'); + .addField('❯ Name', role.name, true) + .addField('❯ ID', role.id, true) + .addField('❯ Color', role.hexColor.toUpperCase(), true) + .addField('❯ Creation Date', role.createdAt.toDateString(), true) + .addField('❯ Hoisted?', role.hoist ? 'Yes' : 'No', true) + .addField('❯ Mentionable?', role.mentionable ? 'Yes' : 'No', true) + .addField('❯ Permissions', perms.map(perm => permissions[perm]).join(', ') || 'None'); return msg.embed(embed); } }; diff --git a/commands/info/server.js b/commands/info/server.js index 11fd1cbc..ad5ac4be 100644 --- a/commands/info/server.js +++ b/commands/info/server.js @@ -21,26 +21,16 @@ module.exports = class ServerInfoCommand extends Command { const embed = new MessageEmbed() .setColor(0x00AE86) .setThumbnail(msg.guild.iconURL()) - .addField('❯ Name', - msg.guild.name, true) - .addField('❯ ID', - msg.guild.id, true) - .addField('❯ Region', - msg.guild.region.toUpperCase(), true) - .addField('❯ Creation Date', - msg.guild.createdAt.toDateString(), true) - .addField('❯ Explicit Filter', - filterLevels[msg.guild.explicitContentFilter], true) - .addField('❯ Verification Level', - verificationLevels[msg.guild.verificationLevel], true) - .addField('❯ Owner', - msg.guild.owner.user.tag, true) - .addField('❯ Members', - msg.guild.memberCount, true) - .addField('❯ Roles', - msg.guild.roles.size, true) - .addField('❯ Channels', - msg.guild.channels.size, true); + .addField('❯ Name', msg.guild.name, true) + .addField('❯ ID', msg.guild.id, true) + .addField('❯ Region', msg.guild.region.toUpperCase(), true) + .addField('❯ Creation Date', msg.guild.createdAt.toDateString(), true) + .addField('❯ Explicit Filter', filterLevels[msg.guild.explicitContentFilter], true) + .addField('❯ Verification Level', verificationLevels[msg.guild.verificationLevel], true) + .addField('❯ Owner', msg.guild.owner.user.tag, true) + .addField('❯ Members', msg.guild.memberCount, true) + .addField('❯ Roles', msg.guild.roles.size, true) + .addField('❯ Channels', msg.guild.channels.size, true); return msg.embed(embed); } }; diff --git a/commands/info/user.js b/commands/info/user.js index 78a18f2f..b8d1cc4c 100644 --- a/commands/info/user.js +++ b/commands/info/user.js @@ -27,22 +27,15 @@ module.exports = class UserInfoCommand extends Command { const embed = new MessageEmbed() .setColor(member.displayHexColor) .setThumbnail(member.user.displayAvatarURL()) - .addField('❯ Name', - member.user.tag, true) - .addField('❯ ID', - member.id, true) - .addField('❯ Discord Join Date', - member.user.createdAt.toDateString(), true) - .addField('❯ Server Join Date', - member.joinedAt.toDateString(), true) - .addField('❯ Nickname', - member.nickname || 'None', true) - .addField('❯ Bot?', - member.user.bot ? 'Yes' : 'No', true) + .addField('❯ Name', member.user.tag, true) + .addField('❯ ID', member.id, true) + .addField('❯ Discord Join Date', member.user.createdAt.toDateString(), true) + .addField('❯ Server Join Date', member.joinedAt.toDateString(), true) + .addField('❯ Nickname', member.nickname || 'None', true) + .addField('❯ Bot?', member.user.bot ? 'Yes' : 'No', true) .addField('❯ Highest Role', member.roles.highest.id !== msg.guild.defaultRole.id ? member.roles.highest.name : 'None', true) - .addField('❯ Hoist Role', - member.roles.hoist ? member.roles.hoist.name : 'None', true); + .addField('❯ Hoist Role', member.roles.hoist ? member.roles.hoist.name : 'None', true); return msg.embed(embed); } }; diff --git a/commands/random/new-york-times.js b/commands/random/new-york-times.js index d9d98917..cf0e9696 100644 --- a/commands/random/new-york-times.js +++ b/commands/random/new-york-times.js @@ -42,8 +42,7 @@ module.exports = class NewYorkTimesCommand extends Command { .setURL(data.web_url) .setTitle(data.headline.main) .setDescription(shorten(data.snippet)) - .addField('❯ Publish Date', - new Date(data.pub_date).toDateString(), true); + .addField('❯ Publish Date', new Date(data.pub_date).toDateString(), true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/forecast.js b/commands/search/forecast.js index 278842fe..01e6a121 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -40,12 +40,11 @@ module.exports = class ForecastCommand extends Command { .setTimestamp(); for (let i = 0; i < 7; i++) { const forecast = data.item.forecast[i]; - embed.addField(`❯ ${forecast.day} - ${forecast.date}`, - stripIndents` - **High**: ${forecast.high}°F - **Low**: ${forecast.low}°F - **Condition**: ${forecast.text} - `); + embed.addField(`❯ ${forecast.day} - ${forecast.date}`, stripIndents` + **High**: ${forecast.high}°F + **Low**: ${forecast.low}°F + **Condition**: ${forecast.text} + `); } return msg.embed(embed); } catch (err) { diff --git a/commands/search/github.js b/commands/search/github.js index cf4e3c55..c40eec53 100644 --- a/commands/search/github.js +++ b/commands/search/github.js @@ -42,18 +42,12 @@ module.exports = class GitHubCommand extends Command { .setURL(body.html_url) .setDescription(body.description ? shorten(body.description) : 'No description.') .setThumbnail(body.owner.avatar_url) - .addField('❯ Stars', - body.stargazers_count, true) - .addField('❯ Forks', - body.forks, true) - .addField('❯ Issues', - body.open_issues, true) - .addField('❯ Language', - body.language || '???', true) - .addField('❯ Creation Date', - new Date(body.created_at).toDateString(), true) - .addField('❯ Modification Date', - new Date(body.updated_at).toDateString(), true); + .addField('❯ Stars', body.stargazers_count, true) + .addField('❯ Forks', body.forks, true) + .addField('❯ Issues', body.open_issues, true) + .addField('❯ Language', body.language || '???', true) + .addField('❯ Creation Date', new Date(body.created_at).toDateString(), true) + .addField('❯ Modification Date', new Date(body.updated_at).toDateString(), true); return msg.embed(embed); } catch (err) { if (err.status === 404) return msg.say('Could not find any results.'); diff --git a/commands/search/google-book.js b/commands/search/google-book.js index 1c874835..fe27077c 100644 --- a/commands/search/google-book.js +++ b/commands/search/google-book.js @@ -42,14 +42,10 @@ module.exports = class GoogleBookCommand extends Command { .setAuthor('Google Books', 'https://i.imgur.com/N3oHABo.png', 'https://books.google.com/') .setDescription(data.description ? shorten(data.description) : 'No description available.') .setThumbnail(data.imageLinks ? data.imageLinks.thumbnail : null) - .addField('❯ Authors', - data.authors.length ? data.authors.join(', ') : '???') - .addField('❯ Publish Date', - data.publishedDate || '???', true) - .addField('❯ Page Count', - data.pageCount || '???', true) - .addField('❯ Genres', - data.categories.length ? data.categories.join(', ') : '???'); + .addField('❯ Authors', data.authors.length ? data.authors.join(', ') : '???') + .addField('❯ Publish Date', data.publishedDate || '???', true) + .addField('❯ Page Count', data.pageCount || '???', true) + .addField('❯ Genres', data.categories.length ? data.categories.join(', ') : '???'); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/itunes.js b/commands/search/itunes.js index 9c0dbf5f..ca95dfcb 100644 --- a/commands/search/itunes.js +++ b/commands/search/itunes.js @@ -49,14 +49,10 @@ module.exports = class ITunesCommand extends Command { .setURL(data.trackViewUrl) .setThumbnail(data.artworkUrl100) .setTitle(data.trackName) - .addField('❯ Artist', - data.artistName, true) - .addField('❯ Album', - data.collectionName, true) - .addField('❯ Release Date', - new Date(data.releaseDate).toDateString(), true) - .addField('❯ Genre', - data.primaryGenreName, true); + .addField('❯ Artist', data.artistName, true) + .addField('❯ Album', data.collectionName, true) + .addField('❯ Release Date', new Date(data.releaseDate).toDateString(), true) + .addField('❯ Genre', data.primaryGenreName, true); return msg.embed(embed); } catch (err) { if (err.status === 400) { diff --git a/commands/search/kickstarter.js b/commands/search/kickstarter.js index 92860aa2..64403788 100644 --- a/commands/search/kickstarter.js +++ b/commands/search/kickstarter.js @@ -39,18 +39,12 @@ module.exports = class KickstarterCommand extends Command { .setAuthor('Kickstarter', 'https://i.imgur.com/EHDlH5t.png', 'https://www.kickstarter.com/') .setDescription(shorten(data.blurb)) .setThumbnail(data.photo ? data.photo.full : null) - .addField('❯ Goal', - `$${data.goal}`, true) - .addField('❯ Pledged', - `$${data.pledged}`, true) - .addField('❯ Backers', - data.backers_count, true) - .addField('❯ Creator', - data.creator.name, true) - .addField('❯ Creation Date', - new Date(data.created_at * 1000).toDateString(), true) - .addField('❯ Deadline', - new Date(data.deadline * 1000).toDateString(), true); + .addField('❯ Goal', `$${data.goal}`, true) + .addField('❯ Pledged', `$${data.pledged}`, true) + .addField('❯ Backers', data.backers_count, true) + .addField('❯ Creator', data.creator.name, true) + .addField('❯ Creation Date', new Date(data.created_at * 1000).toDateString(), true) + .addField('❯ Deadline', new Date(data.deadline * 1000).toDateString(), true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/league-of-legends-champion.js b/commands/search/league-of-legends-champion.js index fde17e37..20372399 100644 --- a/commands/search/league-of-legends-champion.js +++ b/commands/search/league-of-legends-champion.js @@ -40,42 +40,25 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command { .setTitle(`${data.name} ${data.title}`) .setDescription(data.blurb) .setThumbnail(`https://ddragon.leagueoflegends.com/cdn/${this.version}/img/champion/${data.image.full}`) - .addField('❯ Attack', - data.info.attack, true) - .addField('❯ Defense', - data.info.defense, true) - .addField('❯ Magic', - data.info.magic, true) - .addField('❯ Difficulty', - data.info.difficulty, true) - .addField('❯ HP', - `${data.stats.hp} (${data.stats.hpperlevel}/level)`, true) - .addField('❯ HP Regen', - `${data.stats.hpregen} (${data.stats.hpregenperlevel}/level)`, true) - .addField('❯ MP', - `${data.stats.mp} (${data.stats.mpperlevel}/level)`, true) - .addField('❯ MP Regen', - `${data.stats.mpregen} (${data.stats.mpregenperlevel}/level)`, true) - .addField('❯ Resource', - data.partype, true) - .addField('❯ Armor', - `${data.stats.armor} (${data.stats.armorperlevel}/level)`, true) - .addField('❯ Attack Damage', - `${data.stats.attackdamage} (${data.stats.attackdamageperlevel}/level)`, true) - .addField('❯ Attack Range', - data.stats.attackrange, true) + .addField('❯ Attack', data.info.attack, true) + .addField('❯ Defense', data.info.defense, true) + .addField('❯ Magic', data.info.magic, true) + .addField('❯ Difficulty', data.info.difficulty, true) + .addField('❯ HP', `${data.stats.hp} (${data.stats.hpperlevel}/level)`, true) + .addField('❯ HP Regen', `${data.stats.hpregen} (${data.stats.hpregenperlevel}/level)`, true) + .addField('❯ MP', `${data.stats.mp} (${data.stats.mpperlevel}/level)`, true) + .addField('❯ MP Regen', `${data.stats.mpregen} (${data.stats.mpregenperlevel}/level)`, true) + .addField('❯ Resource', data.partype, true) + .addField('❯ Armor', `${data.stats.armor} (${data.stats.armorperlevel}/level)`, true) + .addField('❯ Attack Damage', `${data.stats.attackdamage} (${data.stats.attackdamageperlevel}/level)`, true) + .addField('❯ Attack Range', data.stats.attackrange, true) .addField('❯ Attack Speed Offset', `${data.stats.attackspeedoffset} (${data.stats.attackspeedperlevel}/level)`, true) - .addField('❯ Crit', - `${data.stats.crit} (${data.stats.critperlevel}/level)`, true) - .addField('❯ Move Speed', - data.stats.movespeed, true) - .addField('❯ Spell Block', - `${data.stats.spellblock} (${data.stats.spellblockperlevel}/level)`, true) - .addField('❯ Passive', - data.passive.name, true) - .addField('❯ Spells', - data.spells.map((spell, i) => `${spell.name} (${buttons[i]})`).join('\n'), true); + .addField('❯ Crit', `${data.stats.crit} (${data.stats.critperlevel}/level)`, true) + .addField('❯ Move Speed', data.stats.movespeed, true) + .addField('❯ Spell Block', `${data.stats.spellblock} (${data.stats.spellblockperlevel}/level)`, true) + .addField('❯ Passive', data.passive.name, true) + .addField('❯ Spells', data.spells.map((spell, i) => `${spell.name} (${buttons[i]})`).join('\n'), true); return msg.say(`Tip: ${tips[Math.floor(Math.random() * tips.length)]}`, { embed }); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/my-anime-list-anime.js b/commands/search/my-anime-list-anime.js index e2caa72e..dbd2b8df 100644 --- a/commands/search/my-anime-list-anime.js +++ b/commands/search/my-anime-list-anime.js @@ -41,14 +41,10 @@ module.exports = class MyAnimeListAnimeCommand extends Command { .setThumbnail(data.image[0]) .setTitle(data.title[0]) .setDescription(shorten(cleanXML(data.synopsis[0]))) - .addField('❯ Type', - `${data.type[0]} - ${data.status[0]}`, true) - .addField('❯ Episodes', - data.episodes[0], true) - .addField('❯ Start Date', - data.start_date[0] !== '0000-00-00' ? data.start_date[0] : '???', true) - .addField('❯ End Date', - data.end_date[0] !== '0000-00-00' ? data.end_date[0] : '???', true); + .addField('❯ Type', `${data.type[0]} - ${data.status[0]}`, true) + .addField('❯ Episodes', data.episodes[0], true) + .addField('❯ Start Date', data.start_date[0] !== '0000-00-00' ? data.start_date[0] : '???', true) + .addField('❯ End Date', data.end_date[0] !== '0000-00-00' ? data.end_date[0] : '???', true); return msg.embed(embed); } catch (err) { if (err.message === 'Parse Error') return msg.say('Could not find any results.'); diff --git a/commands/search/my-anime-list-manga.js b/commands/search/my-anime-list-manga.js index 5041e7f0..4f0ecf57 100644 --- a/commands/search/my-anime-list-manga.js +++ b/commands/search/my-anime-list-manga.js @@ -41,14 +41,11 @@ module.exports = class MyAnimeListMangaCommand extends Command { .setThumbnail(data.image[0]) .setTitle(data.title[0]) .setDescription(shorten(cleanXML(data.synopsis[0]))) - .addField('❯ Type', - `${data.type[0]} - ${data.status[0]}`, true) + .addField('❯ Type', `${data.type[0]} - ${data.status[0]}`, true) .addField('❯ Volumes / Chapters', `${Number.parseInt(data.volumes[0], 10) || '???'} / ${Number.parseInt(data.chapters[0], 10) || '???'}`, true) - .addField('❯ Start Date', - data.start_date[0] !== '0000-00-00' ? data.start_date[0] : '???', true) - .addField('❯ End Date', - data.end_date[0] !== '0000-00-00' ? data.end_date[0] : '???', true); + .addField('❯ Start Date', data.start_date[0] !== '0000-00-00' ? data.start_date[0] : '???', true) + .addField('❯ End Date', data.end_date[0] !== '0000-00-00' ? data.end_date[0] : '???', true); return msg.embed(embed); } catch (err) { if (err.message === 'Parse Error') return msg.say('Could not find any results.'); diff --git a/commands/search/neopets-item.js b/commands/search/neopets-item.js index 20625ecd..41aecf28 100644 --- a/commands/search/neopets-item.js +++ b/commands/search/neopets-item.js @@ -32,8 +32,7 @@ module.exports = class NeopetItemCommand extends Command { .setDescription(data.details) .setURL(data.url) .setThumbnail(data.image) - .addField('❯ Price', - data.price ? `${data.price} ${data.currency}` : 'Not for Sale'); + .addField('❯ Price', data.price ? `${data.price} ${data.currency}` : 'Not for Sale'); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/npm.js b/commands/search/npm.js index 702b12bd..ef201519 100644 --- a/commands/search/npm.js +++ b/commands/search/npm.js @@ -37,22 +37,14 @@ module.exports = class NPMCommand extends Command { .setTitle(body.name) .setURL(`https://www.npmjs.com/package/${pkg}`) .setDescription(body.description || 'No description.') - .addField('❯ Version', - body['dist-tags'].latest, true) - .addField('❯ License', - body.license || 'None', true) - .addField('❯ Author', - body.author ? body.author.name : 'Unknown', true) - .addField('❯ Creation Date', - new Date(body.time.created).toDateString(), true) - .addField('❯ Modification Date', - new Date(body.time.modified).toDateString(), true) - .addField('❯ Main File', - version.main || 'index.js', true) - .addField('❯ Dependencies', - dependencies && dependencies.length ? dependencies.join(', ') : 'None') - .addField('❯ Maintainers', - maintainers.join(', ')); + .addField('❯ Version', body['dist-tags'].latest, true) + .addField('❯ License', body.license || 'None', true) + .addField('❯ Author', body.author ? body.author.name : '???', true) + .addField('❯ Creation Date', new Date(body.time.created).toDateString(), true) + .addField('❯ Modification Date', new Date(body.time.modified).toDateString(), true) + .addField('❯ Main File', version.main || 'index.js', true) + .addField('❯ Dependencies', dependencies && dependencies.length ? dependencies.join(', ') : 'None') + .addField('❯ Maintainers', maintainers.join(', ')); return msg.embed(embed); } catch (err) { if (err.status === 404) return msg.say('Could not find any results.'); diff --git a/commands/search/osu.js b/commands/search/osu.js index 822698c1..761743f9 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -36,30 +36,18 @@ module.exports = class OsuCommand extends Command { const embed = new MessageEmbed() .setColor(0xFF66AA) .setAuthor('osu!', 'https://i.imgur.com/hWrw2Sv.png', 'https://osu.ppy.sh/') - .addField('❯ Username', - data.username, true) - .addField('❯ ID', - data.user_id, true) - .addField('❯ Level', - data.level || '???', true) - .addField('❯ Accuracy', - data.accuracy || '???', true) - .addField('❯ Rank', - data.pp_rank || '???', true) - .addField('❯ Play Count', - data.playcount || '???', true) - .addField('❯ Country', - data.country || '???', true) - .addField('❯ Ranked Score', - data.ranked_score || '???', true) - .addField('❯ Total Score', - data.total_score || '???', true) - .addField('❯ SS', - data.count_rank_ss || '???', true) - .addField('❯ S', - data.count_rank_s || '???', true) - .addField('❯ A', - data.count_rank_a || '???', true); + .addField('❯ Username', data.username, true) + .addField('❯ ID', data.user_id, true) + .addField('❯ Level', data.level || '???', true) + .addField('❯ Accuracy', data.accuracy || '???', true) + .addField('❯ Rank', data.pp_rank || '???', true) + .addField('❯ Play Count', data.playcount || '???', true) + .addField('❯ Country', data.country || '???', true) + .addField('❯ Ranked Score', data.ranked_score || '???', true) + .addField('❯ Total Score', data.total_score || '???', true) + .addField('❯ SS', data.count_rank_ss || '???', true) + .addField('❯ S', data.count_rank_s || '???', true) + .addField('❯ A', data.count_rank_a || '???', true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/rotten-tomatoes.js b/commands/search/rotten-tomatoes.js index da3bac9b..0070a699 100644 --- a/commands/search/rotten-tomatoes.js +++ b/commands/search/rotten-tomatoes.js @@ -44,10 +44,8 @@ module.exports = class RottenTomatoesCommand extends Command { .setAuthor('Rotten Tomatoes', 'https://i.imgur.com/Sru8mZ3.jpg', 'https://www.rottentomatoes.com/') .setDescription(shorten(body.ratingSummary.consensus)) .setThumbnail(body.posters.original) - .addField('❯ Critic Score', - criticScore.meterValue ? `${criticScore.meterValue}%` : '???', true) - .addField('❯ Audience Score', - audienceScore.meterScore ? `${audienceScore.meterScore}%` : '???', true); + .addField('❯ Critic Score', criticScore.meterValue ? `${criticScore.meterValue}%` : '???', true) + .addField('❯ Audience Score', audienceScore.meterScore ? `${audienceScore.meterScore}%` : '???', true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/stack-overflow.js b/commands/search/stack-overflow.js index 983195f6..7c65c94a 100644 --- a/commands/search/stack-overflow.js +++ b/commands/search/stack-overflow.js @@ -43,18 +43,12 @@ module.exports = class StackOverflowCommand extends Command { .setAuthor('Stack Overflow', 'https://i.imgur.com/P2jAgE3.png', 'https://stackoverflow.com/') .setURL(data.link) .setTitle(data.title) - .addField('❯ ID', - data.question_id, true) - .addField('❯ Asker', - `[${data.owner.display_name}](${data.owner.link})`, true) - .addField('❯ Views', - data.view_count, true) - .addField('❯ Score', - data.score, true) - .addField('❯ Creation Date', - new Date(data.creation_date * 1000).toDateString(), true) - .addField('❯ Last Activity', - new Date(data.last_activity_date * 1000).toDateString(), true); + .addField('❯ ID', data.question_id, true) + .addField('❯ Asker', `[${data.owner.display_name}](${data.owner.link})`, true) + .addField('❯ Views', data.view_count, true) + .addField('❯ Score', data.score, true) + .addField('❯ Creation Date', new Date(data.creation_date * 1000).toDateString(), true) + .addField('❯ Last Activity', new Date(data.last_activity_date * 1000).toDateString(), true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/steam.js b/commands/search/steam.js index ace1e3e8..287d3782 100644 --- a/commands/search/steam.js +++ b/commands/search/steam.js @@ -51,22 +51,14 @@ module.exports = class SteamCommand extends Command { .setTitle(data.name) .setURL(`http://store.steampowered.com/app/${data.steam_appid}`) .setThumbnail(tiny_image) - .addField('❯ Price', - price, true) - .addField('❯ Metascore', - data.metacritic ? data.metacritic.score : '???', true) - .addField('❯ Recommendations', - data.recommendations ? data.recommendations.total : '???', true) - .addField('❯ Platforms', - platforms.join(', ') || 'None', true) - .addField('❯ Release Date', - data.release_date ? data.release_date.date : '???', true) - .addField('❯ DLC Count', - data.dlc ? data.dlc.length : 0, true) - .addField('❯ Developers', - data.developers.join(', ') || '???') - .addField('❯ Publishers', - data.publishers.join(', ') || '???'); + .addField('❯ Price', price, true) + .addField('❯ Metascore', data.metacritic ? data.metacritic.score : '???', true) + .addField('❯ Recommendations', data.recommendations ? data.recommendations.total : '???', true) + .addField('❯ Platforms', platforms.join(', ') || 'None', true) + .addField('❯ Release Date', data.release_date ? data.release_date.date : '???', true) + .addField('❯ DLC Count', data.dlc ? data.dlc.length : 0, true) + .addField('❯ Developers', data.developers.join(', ') || '???') + .addField('❯ Publishers', data.publishers.join(', ') || '???'); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/stocks.js b/commands/search/stocks.js index fe373109..35420218 100644 --- a/commands/search/stocks.js +++ b/commands/search/stocks.js @@ -37,18 +37,12 @@ module.exports = class StocksCommand extends Command { const embed = new MessageEmbed() .setTitle(`Stocks for ${symbol.toUpperCase()}`) .setColor(0x9797FF) - .addField('❯ Open', - `$${data['1. open']}`, true) - .addField('❯ Close', - `$${data['4. close']}`, true) - .addField('❯ Volume', - data['5. volume'], true) - .addField('❯ High', - `$${data['2. high']}`, true) - .addField('❯ Low', - `$${data['3. low']}`, true) - .addField('❯ Last Updated', - new Date(body['Meta Data']['3. Last Refreshed']).toDateString(), true); + .addField('❯ Open', `$${data['1. open']}`, true) + .addField('❯ Close', `$${data['4. close']}`, true) + .addField('❯ Volume', data['5. volume'], true) + .addField('❯ High', `$${data['2. high']}`, true) + .addField('❯ Low', `$${data['3. low']}`, true) + .addField('❯ Last Updated', new Date(body['Meta Data']['3. Last Refreshed']).toDateString(), true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/tmdb-movie.js b/commands/search/tmdb-movie.js index 87ddbce3..e8855003 100644 --- a/commands/search/tmdb-movie.js +++ b/commands/search/tmdb-movie.js @@ -43,12 +43,9 @@ module.exports = class TMDBMovieCommand extends Command { .setAuthor('TMDB', 'https://i.imgur.com/3K3QMv9.png', 'https://www.themoviedb.org/') .setDescription(body.overview ? shorten(body.overview) : 'No description available.') .setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null) - .addField('❯ Runtime', - body.runtime ? `${body.runtime} mins.` : '???', true) - .addField('❯ Release Date', - body.release_date || '???', true) - .addField('❯ Genres', - body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???') + .addField('❯ Runtime', body.runtime ? `${body.runtime} mins.` : '???', true) + .addField('❯ Release Date', body.release_date || '???', true) + .addField('❯ Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???') .addField('❯ Production Companies', body.production_companies.length ? body.production_companies.map(c => c.name).join(', ') : '???'); return msg.embed(embed); diff --git a/commands/search/tmdb-tv-show.js b/commands/search/tmdb-tv-show.js index 1ce6cdc2..5dd717e0 100644 --- a/commands/search/tmdb-tv-show.js +++ b/commands/search/tmdb-tv-show.js @@ -43,16 +43,11 @@ module.exports = class TMDBTVShowCommand extends Command { .setAuthor('TMDB', 'https://i.imgur.com/3K3QMv9.png', 'https://www.themoviedb.org/') .setDescription(body.overview ? shorten(body.overview) : 'No description available.') .setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null) - .addField('❯ First Air Date', - body.first_air_date || '???', true) - .addField('❯ Last Air Date', - body.last_air_date || '???', true) - .addField('❯ Seasons', - body.number_of_seasons || '???', true) - .addField('❯ Episodes', - body.number_of_episodes || '???', true) - .addField('❯ Genres', - body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???') + .addField('❯ First Air Date', body.first_air_date || '???', true) + .addField('❯ Last Air Date', body.last_air_date || '???', true) + .addField('❯ Seasons', body.number_of_seasons || '???', true) + .addField('❯ Episodes', body.number_of_episodes || '???', true) + .addField('❯ Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???') .addField('❯ Production Companies', body.production_companies.length ? body.production_companies.map(c => c.name).join(', ') : '???'); return msg.embed(embed); diff --git a/commands/search/tumblr.js b/commands/search/tumblr.js index 93a7d4ac..a28ac62c 100644 --- a/commands/search/tumblr.js +++ b/commands/search/tumblr.js @@ -35,10 +35,8 @@ module.exports = class TumblrCommand extends Command { .setThumbnail(`https://api.tumblr.com/v2/blog/${blog}/avatar/512`) .setURL(data.url) .setTitle(data.title) - .addField('❯ Posts', - data.total_posts, true) - .addField('❯ A.M.A.?', - data.ask ? 'Yes' : 'No', true); + .addField('❯ Posts', data.total_posts, true) + .addField('❯ A.M.A.?', data.ask ? 'Yes' : 'No', true); return msg.embed(embed); } catch (err) { if (err.status === 404) return msg.say('Could not find any results.'); diff --git a/commands/search/twitter.js b/commands/search/twitter.js index cb37c93a..9a03a7f8 100644 --- a/commands/search/twitter.js +++ b/commands/search/twitter.js @@ -39,20 +39,13 @@ module.exports = class TwitterCommand extends Command { .setURL(`https://twitter.com/${body.screen_name}`) .setTitle(`${body.name} (@${body.screen_name})`) .setDescription(body.description) - .addField('❯ Tweets', - body.statuses_count, true) - .addField('❯ Followers', - body.followers_count, true) - .addField('❯ Following', - body.friends_count, true) - .addField('❯ Protected?', - body.protected ? 'Yes' : 'No', true) - .addField('❯ Verified?', - body.verified ? 'Yes' : 'No', true) - .addField('❯ Creation Date', - new Date(body.created_at).toDateString(), true) - .addField('❯ Latest Tweet', - body.status ? body.status.text : 'None'); + .addField('❯ Tweets', body.statuses_count, true) + .addField('❯ Followers', body.followers_count, true) + .addField('❯ Following', body.friends_count, true) + .addField('❯ Protected?', body.protected ? 'Yes' : 'No', true) + .addField('❯ Verified?', body.verified ? 'Yes' : 'No', true) + .addField('❯ Creation Date', new Date(body.created_at).toDateString(), true) + .addField('❯ Latest Tweet', body.status ? body.status.text : '???'); return msg.embed(embed); } catch (err) { if (err.status === 401) await this.fetchToken(); diff --git a/commands/search/urban-dictionary.js b/commands/search/urban-dictionary.js index 0f16fc40..91519701 100644 --- a/commands/search/urban-dictionary.js +++ b/commands/search/urban-dictionary.js @@ -45,8 +45,7 @@ module.exports = class UrbanDictionaryCommand extends Command { .setURL(data.permalink) .setTitle(data.word) .setDescription(shorten(data.definition)) - .addField('❯ Example', - data.example ? shorten(data.example, 1000) : 'None'); + .addField('❯ Example', data.example ? shorten(data.example, 1000) : 'None'); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/vocaloid.js b/commands/search/vocaloid.js index 925c85c2..db68a33c 100644 --- a/commands/search/vocaloid.js +++ b/commands/search/vocaloid.js @@ -43,10 +43,8 @@ module.exports = class VocaloidCommand extends Command { .setURL(`http://vocadb.net/S/${data.id}`) .setDescription(data.lyrics.length ? shorten(data.lyrics[0].value) : 'No lyrics available.') .setThumbnail(data.thumbUrl) - .addField('❯ Artist', - data.artistString) - .addField('❯ Publish Date', - new Date(data.publishDate).toDateString(), true); + .addField('❯ Artist', data.artistString) + .addField('❯ Publish Date', new Date(data.publishDate).toDateString(), true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 07882f3e..d36afe56 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -41,18 +41,12 @@ module.exports = class WattpadCommand extends Command { .setTitle(data.title) .setDescription(shorten(data.description)) .setThumbnail(data.cover) - .addField('❯ Creation Date', - new Date(data.createDate).toDateString(), true) - .addField('❯ Author', - data.user, true) - .addField('❯ Chapters', - data.numParts, true) - .addField('❯ Reads', - data.readCount, true) - .addField('❯ Votes', - data.voteCount, true) - .addField('❯ Comments', - data.commentCount, true); + .addField('❯ Creation Date', new Date(data.createDate).toDateString(), true) + .addField('❯ Author', data.user, true) + .addField('❯ Chapters', data.numParts, true) + .addField('❯ Reads', data.readCount, true) + .addField('❯ Votes', data.voteCount, true) + .addField('❯ Comments', data.commentCount, true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/weather.js b/commands/search/weather.js index 45190056..9020cbb6 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -37,30 +37,18 @@ module.exports = class WeatherCommand extends Command { .setAuthor(data.title, 'https://i.imgur.com/B9MMbtB.png', 'https://www.yahoo.com/news/weather') .setURL(data.link) .setTimestamp() - .addField('❯ City', - data.location.city, true) - .addField('❯ Country', - data.location.country, true) - .addField('❯ Region', - data.location.region, true) - .addField('❯ Condition', - data.item.condition.text, true) - .addField('❯ Temperature', - `${data.item.condition.temp}°F`, true) - .addField('❯ Humidity', - data.atmosphere.humidity, true) - .addField('❯ Pressure', - data.atmosphere.pressure, true) - .addField('❯ Rising', - data.atmosphere.rising, true) - .addField('❯ Visibility', - data.atmosphere.visibility, true) - .addField('❯ Wind Chill', - data.wind.chill, true) - .addField('❯ Wind Direction', - data.wind.direction, true) - .addField('❯ Wind Speed', - data.wind.speed, true); + .addField('❯ City', data.location.city, true) + .addField('❯ Country', data.location.country, true) + .addField('❯ Region', data.location.region, true) + .addField('❯ Condition', data.item.condition.text, true) + .addField('❯ Temperature', `${data.item.condition.temp}°F`, true) + .addField('❯ Humidity', data.atmosphere.humidity, true) + .addField('❯ Pressure', data.atmosphere.pressure, true) + .addField('❯ Rising', data.atmosphere.rising, true) + .addField('❯ Visibility', data.atmosphere.visibility, true) + .addField('❯ Wind Chill', data.wind.chill, true) + .addField('❯ Wind Direction', data.wind.direction, true) + .addField('❯ Wind Speed', data.wind.speed, 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/youtube.js b/commands/search/youtube.js index 00958631..f977f791 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -42,12 +42,9 @@ module.exports = class YouTubeCommand extends Command { .setAuthor('YouTube', 'https://i.imgur.com/kKHJg9Q.png', 'https://www.youtube.com/') .setURL(`https://www.youtube.com/watch?v=${data.id.videoId}`) .setThumbnail(data.snippet.thumbnails.default ? data.snippet.thumbnails.default.url : null) - .addField('❯ ID', - data.id.videoId, true) - .addField('❯ Publish Date', - new Date(data.snippet.publishedAt).toDateString(), true) - .addField('❯ Channel', - data.snippet.channelTitle, true); + .addField('❯ ID', data.id.videoId, true) + .addField('❯ Publish Date', new Date(data.snippet.publishedAt).toDateString(), true) + .addField('❯ Channel', data.snippet.channelTitle, true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index 34269ab7..4baf3d69 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { MessageEmbed } = require('discord.js'); const snekfetch = require('snekfetch'); +const { stripIndents } = require('common-tags'); const { shorten } = require('../../util/Util'); module.exports = class YuGiOhCommand extends Command { @@ -14,43 +15,43 @@ module.exports = class YuGiOhCommand extends Command { clientPermissions: ['EMBED_LINKS'], args: [ { - key: 'query', + key: 'card', prompt: 'What card would you like to get information on?', - type: 'string', - parse: text => encodeURIComponent(text) + type: 'string' } ] }); } - async run(msg, { query }) { + async run(msg, { card }) { try { - 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}`); - const { data } = body; + const { text } = await snekfetch + .get('https://www.ygohub.com/api/card_info') + .query({ name: card }); + const body = JSON.parse(text); + if (body.status === 'error') return msg.say('Could not find any results.'); + const data = body.card; const embed = new MessageEmbed() - .attachFiles([{ attachment: image.body, name: 'thumbnail.jpg' }]) .setColor(0xBE5F1F) .setTitle(data.name) .setDescription(shorten(data.text)) .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/AJNBflD.png', 'http://www.yugioh-card.com/') - .setThumbnail('attachment://thumbnail.jpg') - .addField('❯ Card Type', - data.card_type, true); - if (data.card_type === 'monster') { + .setURL(data.tcgplayer_link) + .setThumbnail(data.image_path) + .addField('❯ Card Type', data.type, true); + if (data.is_monster) { embed - .addField('❯ Type', - data.type, true) - .addField('❯ Attribute', - data.family, true) - .addField('❯ Level', - data.level, true) - .addField('❯ ATK', - data.atk, true) - .addField('❯ DEF', - data.def, true); + .addField('❯ Species', data.species, true) + .addField('❯ Attribute', data.attribute, true) + .addField('❯ Level', data.stars, true) + .addField('❯ ATK', data.attack, true) + .addField('❯ DEF', data.defense, true); } + embed.addField('❯ Legality', stripIndents` + TCG Advanced: ${data.legality.TCG.Advanced} + TCG Traditional: ${data.legality.TCG.Traditional} + OCG Advanced: ${data.legality.OCG.Advanced} + `); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js index 4d550f50..e52af496 100644 --- a/commands/text-edit/translate.js +++ b/commands/text-edit/translate.js @@ -70,10 +70,8 @@ module.exports = class TranslateCommand extends Command { const embed = new MessageEmbed() .setColor(0xFF0000) .setFooter('Powered by Yandex.Translate', 'https://i.imgur.com/HMpH9sq.png') - .addField(`❯ From: ${codes[lang[0]]}`, - text) - .addField(`❯ To: ${codes[lang[1]]}`, - body.text[0]); + .addField(`❯ From: ${codes[lang[0]]}`, text) + .addField(`❯ To: ${codes[lang[1]]}`, body.text[0]); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/util/info.js b/commands/util/info.js index 134517cd..3237494e 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -20,22 +20,14 @@ module.exports = class InfoCommand extends Command { const embed = new MessageEmbed() .setColor(0x00AE86) .setFooter('©2017-2018 dragonfire535#8081') - .addField('❯ Servers', - this.client.guilds.size, true) - .addField('❯ Shards', - this.client.options.shardCount, true) - .addField('❯ Commands', - this.client.registry.commands.size, true) - .addField('❯ Home Server', - this.client.options.invite ? `[Here](${this.client.options.invite})` : 'None', true) - .addField('❯ Memory Usage', - `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true) - .addField('❯ Uptime', - duration(this.client.uptime), true) - .addField('❯ Version', - `v${version}`, true) - .addField('❯ Node Version', - process.version, true) + .addField('❯ Servers', this.client.guilds.size, true) + .addField('❯ Shards', this.client.options.shardCount, true) + .addField('❯ Commands', this.client.registry.commands.size, true) + .addField('❯ Home Server', this.client.options.invite ? `[Here](${this.client.options.invite})` : 'None', true) + .addField('❯ Memory Usage', `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true) + .addField('❯ Uptime', duration(this.client.uptime), true) + .addField('❯ Version', `v${version}`, true) + .addField('❯ Node Version', process.version, true) .addField('❯ Library', '[discord.js](https://discord.js.org)[-commando](https://github.com/discordjs/Commando)', true); return msg.embed(embed); diff --git a/package.json b/package.json index 83874413..afeb1852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "72.0.4", + "version": "72.0.5", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {