diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-17 13:36:53 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-17 13:36:53 +0000 |
commit | 570d8535619cf3a9d20ca3d72e5176db2c4c8223 (patch) | |
tree | 21a251cc944946116029bfa3a6245ef6f8e18e66 /lib/rbot/plugins.rb | |
parent | fc051507843ef3b62d9c5f4eacb809d033390992 (diff) |
Fix help. For real
Diffstat (limited to 'lib/rbot/plugins.rb')
-rw-r--r-- | lib/rbot/plugins.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 933ea14f..b0626b96 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -504,8 +504,12 @@ module Plugins when /^(\S+)\s*(.*)$/ key = $1 params = $2 - (core_modules + plugins).each { |p| - next unless p.name == key + + # We test for the mapped commands first + k = key.to_sym + [core_commands, plugin_commands].each { |pl| + next unless pl.has_key?(k) + p = pl[k][:botmodule] begin return p.help(key, params) rescue Exception => err @@ -513,12 +517,12 @@ module Plugins error report_error("#{p.botmodule_class} #{p.name} help() failed:", err) end } - k = key.to_sym - [core_commands, plugin_commands].each { |pl| - next unless pl.has_key?(k) - p = pl[k][:botmodule] + + # If no such commmand was found, we look for a botmodule with that name + (core_modules + plugins).each { |p| + next unless p.name == key begin - return p.help(p.name, params) + return p.help(key, params) rescue Exception => err #rescue TimeoutError, StandardError, NameError, SyntaxError => err error report_error("#{p.botmodule_class} #{p.name} help() failed:", err) |