summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-04 00:44:31 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-04 00:44:31 +0000
commitf1c6f0ba07e5abcd980f1e12e8823ce865bfeeed (patch)
tree35400facfde792fa7a84c61e9c3dc8807e9ff586 /lib/rbot
parent5aa914133c6482c500cf439d65584282212beb6b (diff)
Some fixes for the help system. Still not perfect, but better than before
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/core/config.rb2
-rw-r--r--lib/rbot/core/core.rb2
-rw-r--r--lib/rbot/plugins.rb23
3 files changed, 13 insertions, 14 deletions
diff --git a/lib/rbot/core/config.rb b/lib/rbot/core/config.rb
index 29a0b564..dfbaaab6 100644
--- a/lib/rbot/core/config.rb
+++ b/lib/rbot/core/config.rb
@@ -162,7 +162,7 @@ class ConfigModule < CoreBotModule
m.reply help(params[:topic])
end
- def help(topic="")
+ def help(plugin, topic="")
case topic
when "list"
"config list => list configuration modules, config list <module> => list configuration keys for module <module>"
diff --git a/lib/rbot/core/core.rb b/lib/rbot/core/core.rb
index feff7491..fb626c31 100644
--- a/lib/rbot/core/core.rb
+++ b/lib/rbot/core/core.rb
@@ -90,7 +90,7 @@ class CoreModule < CoreBotModule
# @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick
# handle help requests for "core" topics
- def help(topic="")
+ def help(plugin, topic="")
case topic
when "quit"
return "quit [<message>] => quit IRC with message <message>"
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb
index 42ff2aaa..b55fbe4a 100644
--- a/lib/rbot/plugins.rb
+++ b/lib/rbot/plugins.rb
@@ -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