From a08b4def5c276df964ae2a8d9c3f661593d757e6 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Sat, 16 Jul 2005 01:18:13 +0000 Subject: various fixes by me, plus most of Rene's patch (#1). --- rbot/plugins/fortune.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'rbot/plugins/fortune.rb') diff --git a/rbot/plugins/fortune.rb b/rbot/plugins/fortune.rb index 2f76a318..fd90f69b 100644 --- a/rbot/plugins/fortune.rb +++ b/rbot/plugins/fortune.rb @@ -15,8 +15,13 @@ class FortunePlugin < Plugin m.reply "incorrect usage: " + help(m.plugin) return end - ret = Utils.safe_exec("/usr/games/fortune", "-n", "255", "-s", db) - m.reply ret.split("\n").join(" ") + fortune = nil + ["/usr/games/fortune", "/usr/bin/fortune", "/usr/local/bin/fortune"].each {|f| + fortune = f if FileTest.executable? f + } + m.reply "fortune not found" unless fortune + ret = Utils.safe_exec(fortune, "-n", "255", "-s", db) + m.reply ret.gsub(/\t/, " ").split(/\n/).join(" ") return end end -- cgit v1.2.3