X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fweather.rb;h=b58354471e302101fe349c51d4b5622b2dc3f100;hb=24bb60775741d3731400f1e430ef6bf3a2e1b933;hp=c241daa832f0e8a97f7fd317592478006aca8c0a;hpb=249166efbb959b92011b3b0ef55ca071983f68db;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index c241daa8..b5835447 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -202,9 +202,8 @@ class WeatherPlugin < Plugin else m.reply "couldn't parse weather data from #{where}" end - when //) - m.reply "multiple stations available, use 'weather station ' where code is one of " + stations.join(", ") + when /\s*(.*?)<\/a>\s*:\s*(.*?)<\/td>/m) + m.reply "multiple stations available, use 'weather station ' or 'weather ' as appropriate, for one of the following (current temp shown):" + stations.map! { |ar| + if ar.first # US state + "%s, %s (%s): %s" % [ar[1], ar[0], ar[2], wu_clean(ar[3])] + else # non-US station + "station %s (%s): %s" % [ar[1], ar[2], wu_clean(ar[3])] + end + } + m.reply stations.join("; ") + end + def wu_weather_filter(stuff) txt = wu_clean(stuff)