diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-08 16:36:26 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-08 16:36:26 +0100 |
commit | 3449fbea22b9eae423b60db80cb35950a22e81a9 (patch) | |
tree | 08dc63d7019ea07324b6c7af1b23e88e655ccbda /data | |
parent | f6b6be3b0467b1880d13b89e50bdae027e7b0eb4 (diff) |
fortune plugin: fix autodetection
An empty String is not false in Ruby, so check for it properly. Also,
find_fortune needs a message passed to it, to be used when it discovers
the correct path.
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/fortune.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/data/rbot/plugins/fortune.rb b/data/rbot/plugins/fortune.rb index 79a900fd..d83d6a88 100644 --- a/data/rbot/plugins/fortune.rb +++ b/data/rbot/plugins/fortune.rb @@ -12,9 +12,9 @@ class FortunePlugin < Plugin "fortune [<category>] => get a (short) fortune, optionally specifying fortune category || fortune categories => show categories" end - def find_fortune + def find_fortune(m) fortune = @bot.config['fortune.path'] - return fortune if fortune + return fortune if fortune and not fortune.empty? ["/usr/bin/fortune", "/usr/share/bin/fortune", @@ -45,7 +45,7 @@ class FortunePlugin < Plugin ## Pick a fortune def fortune(m, params) db = params[:db] - fortune = find_fortune + fortune = find_fortune(m) m.reply "fortune executable not found (try setting the 'fortune.path' variable)" unless fortune begin @@ -75,7 +75,7 @@ class FortunePlugin < Plugin # Print the fortune categories def categories(m, params) - fortune = find_fortune + fortune = find_fortune(m) m.reply "fortune executable not found (try setting the 'fortune.path' variable)" unless fortune ## list all fortune databases |