X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Flastfm.rb;h=63935da15e0179feb02f90b3562314ac2379e710;hb=1b8dffbc43b3716ce32086e2e1f88e92adc5056a;hp=81b203f6a74e8a5b36717050e2a018a3bf56cc3d;hpb=7d6a7918ccd9c66bfbbd4fb23a98c781d2e82d08;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index 81b203f6..63935da1 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -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