X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fplugins.rb;h=b0626b9687181c8416e5d3e68e19ce0efaa439b4;hb=a4ff366eea4c88083be8a3d30cc6395f17b55fe2;hp=933ea14f24927dfbb3f3211b1cc31fb497d28015;hpb=91730ddd4bdbbbefbcf7892e5ef6c58eed9f2cb6;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git 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)