summaryrefslogtreecommitdiff
path: root/rbot/plugins/fortune.rb
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
commita08b4def5c276df964ae2a8d9c3f661593d757e6 (patch)
treecd563b11ab095bd364036d14bc28fb5fb4c065a8 /rbot/plugins/fortune.rb
parent71e16adb8a62a78fc1e8cdcc6776b6cd84fbe758 (diff)
various fixes by me, plus most of Rene's patch (#1).
Diffstat (limited to 'rbot/plugins/fortune.rb')
-rw-r--r--rbot/plugins/fortune.rb9
1 files changed, 7 insertions, 2 deletions
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