]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
[plugin] fortune: fixed bin/not-found
authorMatthias H <apoc@sixserv.org>
Thu, 20 Feb 2014 01:37:02 +0000 (02:37 +0100)
committerMatthias H <apoc@sixserv.org>
Thu, 20 Feb 2014 01:37:02 +0000 (02:37 +0100)
data/rbot/plugins/fortune.rb

index 3e2ffdf719a7b7dbd1cfa729bc280c0d1cb3fb7e..fc54aebc353cda9220640cc8130b068a6878450c 100644 (file)
@@ -48,7 +48,10 @@ class FortunePlugin < Plugin
   ## Pick a fortune
   def fortune(m, params)
     fortune = find_fortune(m)
-    m.reply "fortune executable not found (try setting the 'fortune.path' variable)" unless fortune
+    if not fortune or fortune.empty?
+      m.reply "fortune executable not found (try setting the 'fortune.path' variable)"
+      return
+    end
 
     command = [fortune] + @bot.config['fortune.options']
     command << params[:db]
@@ -82,7 +85,10 @@ class FortunePlugin < Plugin
   # Print the fortune categories
   def categories(m, params)
     fortune = find_fortune(m)
-    m.reply "fortune executable not found (try setting the 'fortune.path' variable)" unless fortune
+    if not fortune or fortune.empty?
+      m.reply "fortune executable not found (try setting the 'fortune.path' variable)"
+      return
+    end
 
     ## list all fortune databases
     categories = Utils.safe_exec(fortune, "-f").split(/\n+ */).map{ |f|