summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-12-01 23:01:31 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-12-01 23:01:31 +0000
commit7d6a7918ccd9c66bfbbd4fb23a98c781d2e82d08 (patch)
tree75ce72ce765879d4c911ae82dcb22aedc60d608e
parent5e8ddb21367309624a05ce45c7facee6620b5edf (diff)
fixes from eean
-rw-r--r--data/rbot/plugins/lastfm.rb12
-rw-r--r--lib/rbot/rbotconfig.rb2
2 files changed, 10 insertions, 4 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 042d2d69..81b203f6 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -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'
diff --git a/lib/rbot/rbotconfig.rb b/lib/rbot/rbotconfig.rb
index 042fa39d..226f687e 100644
--- a/lib/rbot/rbotconfig.rb
+++ b/lib/rbot/rbotconfig.rb
@@ -15,7 +15,7 @@ module Irc
else
debug "not installed via rubygems"
end
- rescue LoadError
+ rescue LoadError,NameError,NoMethodError
debug "no rubygems installed"
end