tcpbot/plugins/Help.rb

24 lines
480 B
Ruby
Raw Normal View History

2013-07-07 07:14:53 +00:00
require 'cinch'
require_relative '../classes/Util.rb'
class Help
include Cinch::Plugin
include Util::PluginHelper
2016-03-15 05:18:26 +00:00
@clist = %w{help}
2013-07-07 07:14:53 +00:00
@@commands["help"] = ":help [<cmd>] - produce help for <cmd>"
set :prefix, /^:/
2016-03-15 04:25:53 +00:00
match /help( .+)?/, method: :gethelp
2013-07-07 07:14:53 +00:00
def gethelp(m, mdl = nil)
case mdl
when nil
m.reply("try :help <cmd> to get help for a command.")
else
2016-03-15 04:25:53 +00:00
mdl.strip!
2013-07-07 07:14:53 +00:00
cmds = self.class.class_eval { @@commands }
m.reply(cmds[mdl])
end
end
end