Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit e37faf2

Browse files
author
Tom Bell
committed
Merge pull request #963 from gingermusketeer/master
Update time script to allow api url customisation
2 parents 20e8fde + 58e3abc commit e37faf2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/scripts/time.coffee

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
#
77
# Configuration:
88
# HUBOT_WWO_API_KEY
9+
# HUBOT_WWO_API_URL
910
#
1011
# Commands:
1112
# hubot time in <city> - Get current time in city
1213
#
1314
# Notes
1415
# Request an WWO API KEY in http://www.worldweatheronline.com/
16+
# The url is likely to be something like http://api.worldweatheronline.com/free/v1/tz.ashx
1517
#
1618
# City parameter can be:
1719
# city
@@ -27,7 +29,10 @@ module.exports = (robot) ->
2729
unless process.env.HUBOT_WWO_API_KEY
2830
msg.send 'Please, set HUBOT_WWO_API_KEY environment variable'
2931
return
30-
msg.http('http://www.worldweatheronline.com/feed/tz.ashx')
32+
unless process.env.HUBOT_WWO_API_URL
33+
msg.send 'Please, set HUBOT_WWO_API_URL environment variable'
34+
return
35+
msg.http(process.env.HUBOT_WWO_API_URL)
3136
.query({
3237
q: msg.match[1]
3338
key: process.env.HUBOT_WWO_API_KEY

0 commit comments

Comments
 (0)