summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/weather.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb
index cb0a2b18..afcf394c 100644
--- a/data/rbot/plugins/weather.rb
+++ b/data/rbot/plugins/weather.rb
@@ -71,6 +71,11 @@ class WeatherPlugin < Plugin
Config.register Config::BooleanValue.new('weather.advisory',
:default => true,
:desc => "Should the bot report special weather advisories when any is present?")
+ Config.register Config::EnumValue.new('weather.units',
+ :values => ['metric', 'english', 'both'],
+ :default => 'both',
+ :desc => "Units to be used by default in Weather Underground reports")
+
def help(plugin, topic="")
case topic
@@ -125,15 +130,14 @@ class WeatherPlugin < Plugin
end
wu_units = String.new
- if units
- case units.to_sym
- when :english, :metric
- wu_units = "_#{units}"
- when :both
- else
- m.reply "Ignoring unknown units #{units}"
- wu_units = String.new
- end
+
+ units ||= @bot.config['weather.units']
+ case units.to_sym
+ when :english, :metric
+ wu_units = "_#{units}"
+ when :both
+ else
+ m.reply "Ignoring unknown units #{units}"
end
case service