#-- vim:sw=2:et #++ # # :title: ClientsFromHell plugin for RBot # :author: Jason Hines, # :version: 0.2 # class ClientsFromHellPlugin < Plugin REG = Regexp.new('(.*?)<p><a href', Regexp::MULTILINE) def initialize super @texts = Array.new end def help( plugin, topic="" ) return _("Usage: 'cfh' for random quotes from clientsfromhell.net.") end def clientsfromhell(m, params) opts = { :cache => false } begin if @texts.empty? data = @bot.httputil.get("http://feeds.feedburner.com/ClientsFromHell/", opts) res = data.scan(REG) res.each do |quote| @texts << CGI.unescapeHTML(quote[0]).ircify_html end end text = @texts.pop m.reply text rescue m.reply "failed to connect to clientsfromhell.net" end end end plugin = ClientsFromHellPlugin.new plugin.default_auth('create', false) plugin.map "cfh [:num]", :thread => true, :action => :clientsfromhell, :requirements => { :num => /\d+/ }