From 5b95a8d999c35aa36cf061036de3400231bcd269 Mon Sep 17 00:00:00 2001 From: Matthias H Date: Thu, 20 Feb 2014 02:37:02 +0100 Subject: [plugin] fortune: fixed bin/not-found --- data/rbot/plugins/fortune.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/fortune.rb b/data/rbot/plugins/fortune.rb index 3e2ffdf7..fc54aebc 100644 --- a/data/rbot/plugins/fortune.rb +++ b/data/rbot/plugins/fortune.rb @@ -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| -- cgit v1.2.3