Add command

From Botnix

add_command

main::add_command(commandname,subroutine)

Add a handler for a command. The command name should be in upper case. The command handler subroutine that you provide the name of (as a scalar) should have the following parameter list:

  • $nid - The network where the command was issued
  • $nick - The nick of the user issuing the command
  • $ident - The ident of the user issuing the command
  • $host - The hostname of the user issuing the command
  • @params - The parameters of the command, or undef

The command handler should return a list of lines to be sent to the issuer of the command. Because you cannot easily determine where the command was issued from, this is the only gauranteed way to output data (consider that other modules may be redirecting and piping commands between each other or to other mediums such as telnet or webpages!)

This method of handling commands is recommended over the on_command module event, unless you are handling a strange command format which does not lend well to the command parser.