X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ffortune.rb;h=fc54aebc353cda9220640cc8130b068a6878450c;hb=7b792bea7a644309623d67b5d49528ae13da3e7b;hp=3e2ffdf719a7b7dbd1cfa729bc280c0d1cb3fb7e;hpb=783ffa4235330029d661752b1023db635b26f2b3;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git 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|