From 02b6ba58b1edf5e3813ae3f4c4192e3ea54b33e6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 15 Feb 2009 21:05:30 +0100 Subject: lastfm plugin: show something when no events are found --- data/rbot/plugins/lastfm.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index a9ef6bd9..39074404 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -103,8 +103,10 @@ class LastFmPlugin < Plugin uri = nil if artist == nil uri = "#{APIURL}method=geo.getevents&location=#{CGI.escape location}" + emptymsg = _("no events found in %{location}") % {:location => location} else uri = "#{APIURL}method=artist.getevents&artist=#{CGI.escape artist}" + emptymsg = _("no events found by %{artist}") % {:artist => artist} end xml = @bot.httputil.get_response(uri) @@ -141,6 +143,10 @@ class LastFmPlugin < Plugin h[:artists] = artists events << LastFmEvent.new(h) } + if events.empty? + m.reply emptymsg + return + end events[0...num].each { |event| disp_events << event.to_s } -- cgit v1.2.3