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 6ece8c2825d9a7bc387a924ec9e30fad48ec4a79
parent c21419d120e6451d90b26b617fb8c7fd450a2794
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Thu,  4 Jun 2020 22:16:22 +0530

fix bug

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

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