]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/lastfm.rb
Fixed chucknorris.rb debug output
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / lastfm.rb
index 81b203f6a74e8a5b36717050e2a018a3bf56cc3d..63935da15e0179feb02f90b3562314ac2379e710 100644 (file)
@@ -9,17 +9,12 @@ class LastFmPlugin < Plugin
 
   def do_lastfm (m, params)
     begin
-      if params[:action] == "neighbors" then
+      if params[:action] == "neighbors" || params[:action] == "neighbours" then
         params[:action]="neighbours"
-      elsif params[:action] == "neighbours" then
-        m.reply "Thats not how you spell neighbors, you dolt!"
-        return
       end
       data = open("http://ws.audioscrobbler.com/1.0/user/#{params[:user]}/#{params[:action]}.txt")
       m.reply "#{params[:action]} for #{params[:user]}:"
-      data.to_a[0..2].each do |line|
-        m.reply line.split(',')[-1]
-      end
+      m.reply data.to_a[0..3].map{|l| l.split(',')[-1].chomp}.join(", ")
     rescue
       m.reply "could not find #{params[:action]} for #{params[:user]} (is #{params[:user]} a user?)"
     end