Sha256: 8d6895567f159055933901bf700bc6118b65425d9f9e48ac1358b1c37774ed08

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

require 'active_support'

class Onion < Linkbot::Plugin
  Linkbot::Plugin.register('onion', self,
    {
      :message => {:regex => Regexp.new('!onion'), :handler => :on_message, :help => :help},
      :"direct-message" => {:regex => Regexp.new('!onion'), :handler => :on_message, :help => :help}
    }
  )
  
  def self.on_message(message, matches) 
    links = Hpricot(open('http://feeds.theonion.com/theonion/daily')).search('feedburner:origlink').collect{|l| l.html}
    links[rand(links.length)]
  end
  
  def self.help
    "!onion - return an onion link from the RSS feed"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protolink-0.2.8 example/linkbot/plugins/onion.rb