+#-- vim:sw=2:et
+#++
+#
+# :title: Fortune plugin
+
class FortunePlugin < Plugin
- BotConfig.register BotConfigStringValue.new('fortune.path',
+ Config.register Config::StringValue.new('fortune.path',
:default => '',
:desc => "Full path to the fortune executable")
# Print the fortune categories
def categories(m, params)
## list all fortune files in /usr/share/games/fortune
- categories = Dir["/usr/share/games/fortune/*"].select{|f|File.split(f).last.match /^\w+$/}.select{|f|File.file? f}.map{|p|File.split(p).last}.sort
+ categories = Dir["/usr/share/games/fortune/*"].select{ |f|
+ File.split(f).last.match(/^\w+$/)
+ }.select{ |f|
+ File.file?(f)
+ }.map{ |p|
+ File.split(p).last
+ }.sort
## say 'em!
m.reply "Fortune categories: #{categories.join ', '}"
end