Embed style, better yugioh api

This commit is contained in:
Daniel Odendahl Jr
2018-04-20 13:15:38 +00:00
parent a880d2578b
commit 116582e6a8
35 changed files with 207 additions and 384 deletions
+3 -6
View File
@@ -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!`);
+7 -14
View File
@@ -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);
}
};
+4 -8
View File
@@ -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);
}
};
+7 -14
View File
@@ -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);
}
};
+10 -20
View File
@@ -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);
}
};
+7 -14
View File
@@ -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);
}
};
+1 -2
View File
@@ -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!`);
+5 -6
View File
@@ -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) {
+6 -12
View File
@@ -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.');
+4 -8
View File
@@ -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!`);
+4 -8
View File
@@ -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) {
+6 -12
View File
@@ -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!`);
+17 -34
View File
@@ -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!`);
+4 -8
View File
@@ -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.');
+3 -6
View File
@@ -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.');
+1 -2
View File
@@ -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!`);
+8 -16
View File
@@ -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.');
+12 -24
View File
@@ -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!`);
+2 -4
View File
@@ -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!`);
+6 -12
View File
@@ -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!`);
+8 -16
View File
@@ -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!`);
+6 -12
View File
@@ -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!`);
+3 -6
View File
@@ -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);
+5 -10
View File
@@ -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);
+2 -4
View File
@@ -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.');
+7 -14
View File
@@ -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();
+1 -2
View File
@@ -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!`);
+2 -4
View File
@@ -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!`);
+6 -12
View File
@@ -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!`);
+12 -24
View File
@@ -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!`);
+3 -6
View File
@@ -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!`);
+24 -23
View File
@@ -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!`);
+2 -4
View File
@@ -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!`);
+8 -16
View File
@@ -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);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "72.0.4",
"version": "72.0.5",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {