diff options
-rw-r--r-- | data/rbot/plugins/weather.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 4edcc963..47ab1ca2 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -190,13 +190,18 @@ class WeatherPlugin < Plugin case xml when nil m.reply "couldn't retrieve weather information, sorry" - return when /City Not Found/ m.reply "no such location found (#{where})" - return - when /<table border.*?>(.*?)<\/table>/m - data = $1 - m.reply wu_weather_filter(data) + when /<table/ + data = "" + xml.scan(/<table border.*?>(.*?)<\/table>/m).each do |match| + data += wu_weather_filter(match.first) + end + if data.length > 0 + m.reply data + else + m.reply "couldn't parse weather data from #{where}" + end when /<a href="\/global\/stations\// stations = xml.scan(/<a href="\/global\/stations\/(.*?)\.html">/) m.reply "multiple stations available, use 'weather station <code>' where code is one of " + stations.join(", ") |