summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-15 21:05:30 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-15 21:08:23 +0100
commit02b6ba58b1edf5e3813ae3f4c4192e3ea54b33e6 (patch)
tree38bed5ff43f7aa25452388e72e25b07b65c61166
parent91a9024e21ec8b429605a036b5c9193442a580e3 (diff)
lastfm plugin: show something when no events are found
-rw-r--r--data/rbot/plugins/lastfm.rb6
1 files changed, 6 insertions, 0 deletions
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
}