diff options
-rw-r--r-- | data/rbot/plugins/grouphug.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/data/rbot/plugins/grouphug.rb b/data/rbot/plugins/grouphug.rb index 15735b9f..32a6e55e 100644 --- a/data/rbot/plugins/grouphug.rb +++ b/data/rbot/plugins/grouphug.rb @@ -20,16 +20,19 @@ class GrouphugPlugin < Plugin opts.delete(:cache) end - begin - data = @bot.httputil.get("http://grouphug.us/#{path}", opts) - - reg = Regexp.new( '(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', Regexp::MULTILINE ) - confession = reg.match( data )[4].ircify_html - confession = "no confession ##{params[:num]} found" if confession.empty? and params[:num] - - m.reply confession - rescue - m.reply "failed to connect to grouphug.us" + Thread.start do + begin + data = @bot.httputil.get("http://grouphug.us/#{path}", opts) + + reg = Regexp.new('(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', + Regexp::MULTILINE) + confession = reg.match( data )[4].ircify_html + confession = "no confession ##{params[:num]} found" if confession.empty? and params[:num] + + m.reply confession + rescue + m.reply "failed to connect to grouphug.us" + end end end end |