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

Commit 95fbe6d

Browse files
Merge pull request #1294 from bestimmaa/master
Added metric system forecasts to wunderground script
2 parents f995949 + 6cb3671 commit 95fbe6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/scripts/wunderground.coffee

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# Configuration:
88
# HUBOT_WUNDERGROUND_API_KEY Sign up at http://www.wunderground.com/weather/api/.
9+
# HUBOT_WUNDERGROUND_USE_METRIC Set to arbitrary value to use forecasts with metric system units
910
#
1011
# Commands:
1112
# hubot weather me <location> - short-term forecast
@@ -87,8 +88,8 @@ get_data = (robot, msg, location, service, query, cb, lifetime, stack=0) ->
8788

8889
send_forecast = (msg, location, data) ->
8990
report = data.forecast.txt_forecast.forecastday[0]
90-
msg.send "#{report.title} in #{location}: #{report.fcttext} (#{formatted_ttl data})"
91-
91+
useMetric = process.env.HUBOT_WUNDERGROUND_USE_METRIC?
92+
msg.send "#{report.title} in #{location}: #{if useMetric then report.fcttext_metric else report.fcttext} (#{formatted_ttl data})"
9293
send_radar = (msg, location, data) ->
9394
msg.send "#{data.radar.image_url}#.png"
9495

0 commit comments

Comments
 (0)