diff --git a/README.md b/README.md index 924166af..e223618a 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ on the [home server](https://discord.gg/sbMe32W). * **neopet:** Responds with the image of a specific Neopet. * **neopets-item:** Responds with information on a specific Neopets item. * **npm:** Responds with information on an NPM package. -* **osu:** Responds with information on an Osu! user. +* **osu:** Responds with information on an osu! user. * **periodic-table:** Finds an element on the periodic table. * **pokedex:** Searches the Pokédex for a Pokémon. * **recipe:** Searches for recipes based on your query. diff --git a/commands/events/time.js b/commands/events/time.js index e6493241..656c6bc1 100644 --- a/commands/events/time.js +++ b/commands/events/time.js @@ -1,4 +1,5 @@ const Command = require('../../structures/Command'); +const { firstUpperCase } = require('../../util/Util'); module.exports = class TimeCommand extends Command { constructor(client) { @@ -15,7 +16,7 @@ module.exports = class TimeCommand extends Command { label: 'time zone', prompt: 'Which time zone do you want to get the time of?', type: 'string', - parse: timeZone => timeZone.replace(/ /g, '_').toUpperCase() + parse: timeZone => timeZone.replace(/ /g, '_').toLowerCase() } ] }); @@ -23,13 +24,18 @@ module.exports = class TimeCommand extends Command { run(msg, { timeZone }) { let neopia = false; - if (timeZone === 'NEOPIA/STANDARD' || timeZone === 'NEOPIA') { - timeZone = 'AMERICA/VANCOUVER'; + if (timeZone === 'neopia/standard' || timeZone === 'neopia') { + timeZone = 'america/vancouver'; neopia = true; } try { const time = new Date().toLocaleTimeString('en-US', { timeZone }); - return msg.say(`The current time in ${neopia ? 'NEOPIA' : timeZone} is ${time}.`); + const location = neopia ? ['neopia'] : timeZone.split('/'); + const main = firstUpperCase(location[0], /[_ ]/); + const sub = location[1] ? firstUpperCase(location[1], /[_ ]/) : null; + const subMain = location[2] ? firstUpperCase(location[2], /[_ ]/) : null; + const parens = sub ? ` (${subMain ? `${sub}, ` : ''}${main})` : ''; + return msg.say(`The current time in ${subMain || sub || main}${parens} is ${time}.`); } catch (err) { return msg.reply('Invalid time zone. Refer to .'); } diff --git a/commands/events/today-in-history.js b/commands/events/today-in-history.js index c97ad7c3..4c5dc43c 100644 --- a/commands/events/today-in-history.js +++ b/commands/events/today-in-history.js @@ -44,7 +44,7 @@ module.exports = class TodayInHistoryCommand extends Command { .setTimestamp() .setDescription(`${event.year}: ${event.text}`) .addField('❯ See More', - event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join(', ')); + event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join('\n')); return msg.embed(embed); } catch (err) { if (err.status === 404 || err.status === 500) return msg.say('Invalid date.'); diff --git a/commands/random/would-you-rather.js b/commands/random/would-you-rather.js index d0a2d95a..40567c25 100644 --- a/commands/random/would-you-rather.js +++ b/commands/random/would-you-rather.js @@ -5,7 +5,7 @@ module.exports = class WouldYouRatherCommand extends Command { constructor(client) { super(client, { name: 'would-you-rather', - aliases: ['wy-rather'], + aliases: ['wy-rather', 'wyr'], group: 'random', memberName: 'would-you-rather', description: 'Responds with a random "Would you rather ...?" question.' diff --git a/commands/search/osu.js b/commands/search/osu.js index a93a1708..963f0c17 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -10,7 +10,7 @@ module.exports = class OsuCommand extends Command { aliases: ['osu-user', 'osu-stats'], group: 'search', memberName: 'osu', - description: 'Responds with information on an Osu! user.', + description: 'Responds with information on an osu! user.', clientPermissions: ['EMBED_LINKS'], args: [ { @@ -39,7 +39,7 @@ module.exports = class OsuCommand extends Command { .addField('❯ Username', data.username, true) .addField('❯ ID', data.user_id, true) .addField('❯ Level', data.level || '???', true) - .addField('❯ Accuracy', data.accuracy || '???', true) + .addField('❯ Accuracy', data.accuracy ? `${Math.round(data.accuracy)}%` : '???', true) .addField('❯ Rank', data.pp_rank || '???', true) .addField('❯ Play Count', data.playcount || '???', true) .addField('❯ Country', data.country || '???', true) diff --git a/commands/text-edit/mocking.js b/commands/text-edit/mocking.js index b6c9ebea..e07693ce 100644 --- a/commands/text-edit/mocking.js +++ b/commands/text-edit/mocking.js @@ -16,15 +16,18 @@ module.exports = class MockingCommand extends Command { prompt: 'WHaT tEXt WoUlD yOu LiKE to COnvErt?', type: 'string', max: 1950, - parse: text => text.toLowerCase().split('') + parse: text => text.toLowerCase() } ] }); } run(msg, { text }) { - for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase(); - return msg.say(`${text.join('')} <:mocking:${MOCKING_EMOJI_ID}>`); + const letters = text.split(''); + for (let i = 0; i < letters.length; i += Math.floor(Math.random() * 4)) { + letters[i] = letters[i].toUpperCase(); + } + return msg.say(`${letters.join('')} <:mocking:${MOCKING_EMOJI_ID}>`); } }; diff --git a/commands/text-edit/organization-xiii-name.js b/commands/text-edit/organization-xiii-name.js index 78e7a617..789e9707 100644 --- a/commands/text-edit/organization-xiii-name.js +++ b/commands/text-edit/organization-xiii-name.js @@ -1,11 +1,26 @@ const Command = require('../../structures/Command'); -const { shuffle } = require('../../util/Util'); +const { shuffle, firstUpperCase } = require('../../util/Util'); module.exports = class OrganizationXIIINameCommand extends Command { constructor(client) { super(client, { name: 'organization-xiii-name', - aliases: ['xiii-name', 'nobody-name', 'organization-xiii', 'org-xiii', 'xiii', 'organization-13-name', 'org-13'], + aliases: [ + 'organization-xiii', + 'xiii-name', + 'xiii', + '13-name', + 'org-xiii-name', + 'org-xiii', + 'organization-13-name', + 'organization-13', + 'org-13-name', + 'org-13', + 'organization-name', + 'org-name', + 'org', + 'nobody-name' + ], group: 'text-edit', memberName: 'organization-xiii-name', description: 'Converts a name into the Organization XIII style.', @@ -15,16 +30,16 @@ module.exports = class OrganizationXIIINameCommand extends Command { prompt: 'What name would you like to convert?', type: 'string', max: 1950, - parse: text => text.toLowerCase().split('') + parse: text => text.toLowerCase() } ] }); } run(msg, { text }) { - text.push('x'); - const shuffled = shuffle(text); - shuffled[0] = shuffled[0].toUpperCase(); - return msg.say(shuffled.join('')); + const letters = text.split(''); + letters.push('x'); + const shuffled = shuffle(letters); + return msg.say(firstUpperCase(shuffled.join(''))); } }; diff --git a/package.json b/package.json index 115024ee..af8e4650 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "91.1.6", + "version": "91.1.7", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/util/Util.js b/util/Util.js index 3ea53c4d..15ab32de 100644 --- a/util/Util.js +++ b/util/Util.js @@ -48,8 +48,8 @@ module.exports = class Util { return arr; } - static firstUpperCase(text) { - return `${text.charAt(0).toUpperCase()}${text.slice(1)}`; + static firstUpperCase(text, split = ' ') { + return text.split(split).map(word => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(' '); } static base64(text, mode = 'encode') {