diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-12-01 23:01:31 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-12-01 23:01:31 +0000 |
commit | 7d6a7918ccd9c66bfbbd4fb23a98c781d2e82d08 (patch) | |
tree | 75ce72ce765879d4c911ae82dcb22aedc60d608e /data/rbot | |
parent | 5e8ddb21367309624a05ce45c7facee6620b5edf (diff) |
fixes from eean
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 12 |
1 files changed, 9 insertions, 3 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' |