enwnbot

Converts MediaWiki [[links]] and {{templates}} to links on IRC
git clone http://git.hanabi.in/repos/enwnbot.git
Log | Files | Refs | README | LICENSE

commit fddca73db6e2e4068330b1adfc94e5ca4d58efbd
parent 6ece8c2825d9a7bc387a924ec9e30fad48ec4a79
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Fri,  5 Jun 2020 23:10:58 +0530

anywhere in the message

Diffstat:
Mutils.js | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/utils.js b/utils.js @@ -44,13 +44,15 @@ function getFullTemplate(template) { } function sayTime(msg, client, channel) { - const user = msg.split(' ').filter(Boolean)[2]; + let arr = msg.split(' ').filter(Boolean); + while (arr[1] != '!time') arr.shift(); + const user = arr[2]; const timezone = timezones.get(user) || user; let time; try { time = moment().tz(timezone).format('HH:mm MMM DD'); } catch (error) { - time = moment().tz('UTC').format('HH:mm MMM DD') + ' UTC'; + time = `${moment().tz('UTC').format('HH:mm MMM DD')} UTC`; } client.say(channel, time); }