X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ffortune.rb;h=adb6a839a656a0897387508d6792ed63792b222d;hb=21947daae8f66141d3c53ce2f58eab60701d52bf;hp=467d452dffce28521da225d3b40425f813f6c033;hpb=0109f67cc75ceded351b0023c6fb77d9bcccbcd1;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/fortune.rb b/data/rbot/plugins/fortune.rb index 467d452d..adb6a839 100644 --- a/data/rbot/plugins/fortune.rb +++ b/data/rbot/plugins/fortune.rb @@ -1,5 +1,10 @@ +#-- 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") @@ -66,7 +71,13 @@ class FortunePlugin < Plugin # 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