1 class FortunePlugin < Plugin
2 def help(plugin, topic="")
3 "fortune [<module>] => get a (short) fortune, optionally specifying fortune db"
8 ["/usr/games/fortune", "/usr/bin/fortune", "/usr/local/bin/fortune"].each {|f|
9 if FileTest.executable? f
14 m.reply "fortune binary not found" unless fortune
15 ret = Utils.safe_exec(fortune, "-n", "255", "-s", db)
16 m.reply ret.gsub(/\t/, " ").split(/\n/).join(" ")
20 plugin = FortunePlugin.new
21 plugin.map 'fortune :db', :defaults => {:db => 'fortunes'},
22 :requirements => {:db => /^[^-][\w-]+$/}