- if fortune.empty?
- ["/usr/share/games/fortune",
- "/usr/share/bin/fortune",
- "/usr/games/fortune",
- "/usr/bin/fortune",
- "/usr/local/games/fortune",
- "/usr/local/bin/fortune"].each {|f|
- if FileTest.executable? f
- fortune = f
-
- # Try setting the config entry
- config_par = {:key => 'fortune.path', :value => [f], :silent => true }
- debug "Setting fortune.path to #{f}"
- set_path = @bot.plugins['config'].handle_set(m, config_par)
- if set_path
- debug "fortune.path set to #{@bot.config['fortune.path']}"
- else
- debug "couldn't set fortune.path"
- end
-
- break
- end
- }
+ return fortune if fortune and not fortune.empty?
+
+ ["/usr/bin/fortune",
+ "/usr/share/bin/fortune",
+ "/usr/games/fortune",
+ "/usr/local/games/fortune",
+ "/usr/local/bin/fortune"].each do |f|
+ if FileTest.executable? f
+ fortune = f
+ break
+ end
+ end
+
+ return nil unless fortune
+
+ # Try setting the config entry
+ config_par = {:key => 'fortune.path', :value => [fortune], :silent => true }
+ debug "Setting fortune.path to #{fortune}"
+ set_path = @bot.plugins['config'].handle_set(m, config_par)
+ if set_path
+ debug "fortune.path set to #{@bot.config['fortune.path']}"
+ else
+ debug "couldn't set fortune.path"