From: Giuseppe Bilotta Date: Mon, 16 Feb 2009 21:05:35 +0000 (+0100) Subject: lastfm: say something when user top/weekly chart is empty X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;ds=sidebyside;h=784ca0872a8d285854fe3ebbf90aefe5296a4439;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git lastfm: say something when user top/weekly chart is empty --- diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index 71fde1f4..29f85aab 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -550,7 +550,11 @@ class LastFmPlugin < Plugin :bold => Bold } end - m.reply items[0, num].join(", ") + if items.empty? + m.reply _("%{user} hasn't played anything in this period of time") % { :user => user } + else + m.reply items[0, num].join(", ") + end end end