mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 10:02:05 +02:00
Add check for time
This commit is contained in:
@@ -36,10 +36,11 @@ module.exports = class TimeCommand extends Command {
|
|||||||
run(msg, { timeZone }) {
|
run(msg, { timeZone }) {
|
||||||
const time = moment().tz(timeZone).format('h:mm A');
|
const time = moment().tz(timeZone).format('h:mm A');
|
||||||
const location = timeZone.split('/');
|
const location = timeZone.split('/');
|
||||||
|
const word = location === 'lily' ? 'for' : 'is';
|
||||||
const main = firstUpperCase(location[0], /[_ ]/);
|
const main = firstUpperCase(location[0], /[_ ]/);
|
||||||
const sub = location[1] ? firstUpperCase(location[1], /[_ ]/) : null;
|
const sub = location[1] ? firstUpperCase(location[1], /[_ ]/) : null;
|
||||||
const subMain = location[2] ? firstUpperCase(location[2], /[_ ]/) : null;
|
const subMain = location[2] ? firstUpperCase(location[2], /[_ ]/) : null;
|
||||||
const parens = sub ? ` (${subMain ? `${sub}, ` : ''}${main})` : '';
|
const parens = sub ? ` (${subMain ? `${sub}, ` : ''}${main})` : '';
|
||||||
return msg.say(`The current time in ${subMain || sub || main}${parens} is ${time}.`);
|
return msg.say(`The current time ${word} ${subMain || sub || main}${parens} is ${time}.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "152.4.11",
|
"version": "152.4.12",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user