]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
fixes from eean
authorTom Gilbert <tom@linuxbrit.co.uk>
Thu, 1 Dec 2005 23:01:31 +0000 (23:01 +0000)
committerTom Gilbert <tom@linuxbrit.co.uk>
Thu, 1 Dec 2005 23:01:31 +0000 (23:01 +0000)
data/rbot/plugins/lastfm.rb
lib/rbot/rbotconfig.rb

index 042d2d69227c92f7ed99bbc87fe1b4bd0f591d03..81b203f6a74e8a5b36717050e2a018a3bf56cc3d 100644 (file)
@@ -1,14 +1,20 @@
 require 'open-uri'
 
 # plugin submitted by Jeremy Voorhis (jvoorhis)
+
 class LastFmPlugin < Plugin
   def help(plugin, topic="")
     "lastfm <function> <user> => lastfm data for <user> on last.fm where <function> in [recenttracks, topartists, topalbums, toptracks, tags, friends, neighbors]"
   end
+
   def do_lastfm (m, params)
     begin
+      if params[:action] == "neighbors" 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|
@@ -19,6 +25,6 @@ class LastFmPlugin < Plugin
     end
   end
 end
+
 plugin = LastFmPlugin.new
 plugin.map 'lastfm :action :user', :action => 'do_lastfm'
index 042fa39d73988b6b00018149f4893f87bb268478..226f687ed9bfe3310241d1cfcf26f72e547ef34d 100644 (file)
@@ -15,7 +15,7 @@ module Irc
       else
         debug "not installed via rubygems"
       end
-    rescue LoadError
+    rescue LoadError,NameError,NoMethodError
       debug "no rubygems installed"
     end