Sha256: 3b04e5664399c7af8342c00e7bf057602839f721df84f118f2868be851ab98b8
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
class Qwantz < Linkbot::Plugin Linkbot::Plugin.register('qwantz', self, { :message => {:regex => /!qwantz/, :handler => :on_message, :help => :help}, :"direct-message" => {:regex => /!qwantz/, :handler => :on_message, :help => :help} } ) def self.on_message(message, matches) doc = Hpricot(open('http://qwantz.com/index.php')) link = doc.search("div.randomquote a")[1] doc = Hpricot(open(link['href'])) img = doc.search('img.comic') "#{link.inner_html.strip}\n#{img.first['src']}" end def self.help helpers = [ "HILARIOUS OUTTAKES COMICS", "PHILOSOPHY COMICS", "UNINFORMED OPINIONS ABOUT ARCHAEOLOGY COMICS", "COMICS WITH NON-TWIST ENDINGS", "COMICS FROM THE FUTURE", "ENTHUSIASTIC USE OF OUTDATED CATCH-PHRASES COMICS", "BAD DECISIONS COMICS" ] "!qwantz - #{helpers[rand(helpers.length)]}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
protolink-0.2.8 | example/linkbot/plugins/qwantz.rb |