30 lines
604 B
Ruby
30 lines
604 B
Ruby
class Help
|
|
include Cinch::Plugin
|
|
|
|
match /h[ae]lp(?:\s+(\w+))?/
|
|
|
|
def execute(m, command)
|
|
if command.nil?
|
|
names = bot.plugins.map do |plugin|
|
|
plugin.class.name.downcase
|
|
end
|
|
m.reply "my sacred powers: #{names.join(", ")}"
|
|
else
|
|
m.reply "looking for #{command}..."
|
|
plug = bot.plugins.first do |plugin|
|
|
plugin.class.name.downcase == command
|
|
end
|
|
|
|
unless plug.nil?
|
|
m.reply plug.class.help
|
|
else
|
|
m.reply "keep trying, buddy. you'll get it eventually."
|
|
end
|
|
end
|
|
end
|
|
|
|
def help
|
|
"help [command] - figure out how to use one (1) of two (2) commands"
|
|
end
|
|
end
|