diff options
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 12 | ||||
-rw-r--r-- | lib/rbot/rbotconfig.rb | 2 |
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 |