]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Some fixes for the help system. Still not perfect, but better than before
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 4 Aug 2006 00:44:31 +0000 (00:44 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 4 Aug 2006 00:44:31 +0000 (00:44 +0000)
lib/rbot/core/config.rb
lib/rbot/core/core.rb
lib/rbot/plugins.rb

index 29a0b56467f2bc91fc797f1201207c91c786d244..dfbaaab66d05fb5da16c4ba3ac2d202aff60f59c 100644 (file)
@@ -162,7 +162,7 @@ class ConfigModule < CoreBotModule
     m.reply help(params[:topic])\r
   end\r
 \r
-  def help(topic="")\r
+  def help(plugin, topic="")\r
     case topic\r
     when "list"\r
       "config list => list configuration modules, config list <module> => list configuration keys for module <module>"\r
index feff7491b058f6445e13ffba4cb6f1b83ff9b667..fb626c317b961936ab9ce0637ad817e6feeb37fe 100644 (file)
@@ -90,7 +90,7 @@ class CoreModule < CoreBotModule
   #   @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
 \r
   # handle help requests for "core" topics\r
-  def help(topic="")\r
+  def help(plugin, topic="")\r
     case topic\r
     when "quit"\r
       return "quit [<message>] => quit IRC with message <message>"\r
index 42ff2aaa959382c6992b25b9bba7f8f3670d38a8..b55fbe4a115d559b277a305571428225bc8f9a2e 100644 (file)
@@ -507,24 +507,23 @@ module Plugins
         key = $1
         params = $2
         (core_modules + plugins).each { |p|
-          # debug "checking #{p.name.inspect} against #{key.inspect}"
+         next unless p.name == key
           begin
-            return p.help(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)
-          end if p.name == key
+          end
         }
+        k = key.to_sym
         [core_commands, plugin_commands].each { |pl|
-          # debug "looking for #{key.inspect} in #{pl.keys.sort.inspect}"
-          if pl.has_key?(key)
-            p = pl[key][:botmodule] 
-            begin
-              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)
-            end
+          next unless pl.has_key?(k)
+          p = pl[k][:botmodule] 
+          begin
+            return p.help(p.name, topic)
+          rescue Exception => err
+            #rescue TimeoutError, StandardError, NameError, SyntaxError => err
+            error report_error("#{p.botmodule_class} #{p.name} help() failed:", err)
           end
         }
       end