(.*?)<\/div>/m)
+ if page.match(/
(.*?)<\/div>/m)
wiki = $1.ircify_html
end
@@ -178,25 +176,23 @@ class LastFmPlugin < Plugin
action = params[:action].intern
action = :neighbours if action == :neighbors
user = params[:user]
- Thread.new {
- begin
- data = @bot.httputil.get("http://ws.audioscrobbler.com/1.0/user/#{user}/#{action}.txt")
- m.reply "#{action} for #{user}:"
- m.reply data.to_a[0..3].map{|l| l.split(',',2)[-1].chomp}.join(", ")
- rescue
- m.reply "could not find #{action} for #{user} (is #{user} a user?)"
- end
- }
+ begin
+ data = @bot.httputil.get("http://ws.audioscrobbler.com/1.0/user/#{user}/#{action}.txt")
+ m.reply "#{action} for #{user}:"
+ m.reply data.to_a[0..3].map{|l| l.split(',',2)[-1].chomp}.join(", ")
+ rescue
+ m.reply "could not find #{action} for #{user} (is #{user} a user?)"
+ end
end
end
plugin = LastFmPlugin.new
-plugin.map 'lastfm [:num] event[s] in *location', :action => :find_event, :requirements => { :num => /\d+/ }
-plugin.map 'lastfm [:num] event[s] by *who', :action => :find_event, :requirements => { :num => /\d+/ }
-plugin.map 'lastfm [:num] event[s] [for] *who', :action => :find_event, :requirements => { :num => /\d+/ }
-plugin.map 'lastfm artist *who', :action => :find_artist
-plugin.map 'lastfm group *who', :action => :find_artist
+plugin.map 'lastfm [:num] event[s] in *location', :action => :find_event, :requirements => { :num => /\d+/ }, :thread => true
+plugin.map 'lastfm [:num] event[s] by *who', :action => :find_event, :requirements => { :num => /\d+/ }, :thread => true
+plugin.map 'lastfm [:num] event[s] [for] *who', :action => :find_event, :requirements => { :num => /\d+/ }, :thread => true
+plugin.map 'lastfm artist *who', :action => :find_artist, :thread => true
+plugin.map 'lastfm group *who', :action => :find_artist, :thread => true
plugin.map 'lastfm track *dunno', :action => :find_track
plugin.map 'lastfm song *dunno', :action => :find_track
plugin.map 'lastfm album *dunno', :action => :find_album
-plugin.map 'lastfm :action *user'
+plugin.map 'lastfm :action *user', :thread => true