Strip the .txt extension from COPYING, LICENSE, and README
[dcbot.git] / plugins / help.rb
blobf788ff4f0c408bca71a69fcc14cd2c7e57e0c5db
1 class HelpPlugin < PluginBase
2   def self.cmd_help(socket, sender, isprivate, args)
3     socket.sendPrivateMessage(sender, "Available commands are:")
4     PluginBase.commands.each do |cmd|
5       message = "#{CMD_PREFIX}#{cmd}"
6       if PluginBase.has_command_help?(cmd) then
7         arghelp, cmdhelp = PluginBase.command_help(cmd).call()
8         message << " #{arghelp}" unless arghelp.nil? or arghelp.empty?
9         message << " - #{cmdhelp}"
10         socket.sendPrivateMessage(sender, "  #{message}")
11       end
12     end
13   end
14   
15   def self.cmd_help_help
16     [nil, "Displays this help"]
17   end
18   
19   def self.cmd_about(socket, sender, isprivate, args)
20     about = <<EOF
21 I am a Direct Connect bot written in Ruby.
22 I was written by Kevin Ballard <kevin@sb.org>.
23 My code is available at http://repo.or.cz/w/dcbot.git
24 EOF
25     about.split("\n").each do |line|
26       socket.sendPrivateMessage(sender, line)
27     end
28   end
29   
30   def self.cmd_about_help
31     [nil, "Displays information about this bot"]
32   end
33 end