diff --git a/assets/json/quote.json b/assets/json/quote.json index 671bffcc..55193604 100644 --- a/assets/json/quote.json +++ b/assets/json/quote.json @@ -403,6 +403,10 @@ "quote": "You’ve got mountains of your own, I’ll bet on it. Take heart. Be encouraged. Remain steadfast. Hang on for dear life. You’ve got a better grip than you realize.", "author": "Adam Young" }, + { + "quote": "I did not have sexual relations with that woman.", + "author": "Bill Clinton" + }, { "quote": "Eat pant.", "author": "Dragon Fire" diff --git a/commands/search/itunes.js b/commands/search/itunes.js index 597b59a7..591d5c1a 100644 --- a/commands/search/itunes.js +++ b/commands/search/itunes.js @@ -1,8 +1,6 @@ const { Command } = require('discord.js-commando'); const { MessageEmbed } = require('discord.js'); const snekfetch = require('snekfetch'); -const { list } = require('../../util/Util'); -const countries = ['us', 'jp']; module.exports = class ITunesCommand extends Command { constructor(client) { @@ -12,16 +10,13 @@ module.exports = class ITunesCommand extends Command { group: 'search', memberName: 'itunes', description: 'Searches iTunes for your query.', + details: '**Codes**: ', clientPermissions: ['EMBED_LINKS'], args: [ { key: 'country', - prompt: `What country should results be obtained for? Either ${list(countries, 'or')}.`, + prompt: 'What country code should results be obtained for?', type: 'string', - validate: country => { - if (countries.includes(country.toLowerCase())) return true; - return `Invalid country, please enter either ${list(countries, 'or')}.`; - }, parse: country => country.toLowerCase() }, { @@ -64,6 +59,9 @@ module.exports = class ITunesCommand extends Command { data.primaryGenreName, true); return msg.embed(embed); } catch (err) { + if (err.status === 500) { + return msg.reply('Invalid country code. Refer to .'); + } return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } diff --git a/util/Util.js b/util/Util.js index b6d4192e..7881ed1b 100644 --- a/util/Util.js +++ b/util/Util.js @@ -51,6 +51,10 @@ class Util { return arr; } + static formatNumber(number, dollar = false) { + return `${dollar ? '$' : ''}${number.toLocaleString('en-US', { maximumFractionDigits: 2 })}`; + } + static cleanXML(text) { return text .replace(/
/g, '')