diff --git a/commands/events/time.js b/commands/events/time.js index 6b695c1b..c8ec0b94 100644 --- a/commands/events/time.js +++ b/commands/events/time.js @@ -25,20 +25,19 @@ module.exports = class TimeCommand extends Command { run(msg, { timeZone }) { let neopia = false; - if (timeZone === 'neopia/standard' || timeZone === 'neopia') { + if (timeZone === 'neopia') { timeZone = 'america/vancouver'; neopia = true; } - try { - const time = moment().tz(timeZone).format('hh:mm:ss A'); - 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) { + if (!moment.tz.zone(timeZone)) { return msg.reply('Invalid time zone. Refer to .'); } + const time = moment().tz(timeZone).format('hh:mm:ss A'); + 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}.`); } }; diff --git a/package.json b/package.json index baeb6f69..89c5f692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "91.8.4", + "version": "91.8.5", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {