def help(cmd, topic="")
case cmd
when "login"
return _("login [<botuser>] [<pass>]: logs in to the bot as botuser <botuser> with password <pass>. When using the full form, you must contact the bot in private. <pass> can be omitted if <botuser> allows login-by-mask and your netmask is among the known ones. if <botuser> is omitted too autologin will be attempted")
when "whoami"
return _("whoami: names the botuser you're linked to")
when "who"
return _("who is <user>: names the botuser <user> is linked to")
when /^permission/
case topic
when "syntax"
return _("a permission is specified as module::path::to::cmd; when you want to enable it, prefix it with +; when you want to disable it, prefix it with -; when using the +reset+ command, do not use any prefix")
when "set", "reset", "[re]set", "(re)set"
return _("permissions [re]set <permission> [in <channel>] for <user>: sets or resets the permissions for botuser <user> in channel <channel> (use ? to change the permissions for private addressing)")
when "view"
return _("permissions view [for <user>]: display the permissions for user <user>")
when "search"
return _("permissions search <pattern>: display the permissions associated with the commands matching <pattern>")
else
return _("permission topics: syntax, (re)set, view, search")
end
when "user"
case topic
when "show"
return _("user show <what> : shows info about the user; <what> can be any of autologin, login-by-mask, netmasks")
when /^(en|dis)able/
return _("user enable|disable <what> : turns on or off <what> (autologin, login-by-mask)")
when "set"
return _("user set password <blah> : sets the user password to <blah>; passwords can only contain upper and lowercase letters and numbers, and must be at least 4 characters long")
when "add", "rm"
return _("user add|rm netmask <mask> : adds/removes netmask <mask> from the list of netmasks known to the botuser you're linked to")
when "reset"
return _("user reset <what> : resets <what> to the default values. <what> can be +netmasks+ (the list will be emptied), +autologin+ or +login-by-mask+ (will be reset to the default value) or +password+ (a new one will be generated and you'll be told in private)")
when "tell"
return _("user tell <who> the password for <botuser> : contacts <who> in private to tell him/her the password for <botuser>")
when "create"
return _("user create <name> <password> : create botuser named <name> with password <password>. The password can be omitted, in which case a random one will be generated. The <name> should only contain alphanumeric characters and the underscore (_)")
when "list"
return _("user list : lists all the botusers")
when "destroy"
return _("user destroy <botuser> : destroys <botuser>. This function %{highlight}must%{highlight} be called in two steps. On the first call <botuser> is queued for destruction. On the second call, which must be in the form 'user confirm destroy <botuser>', the botuser will be destroyed. If you want to cancel the destruction, issue the command 'user cancel destroy <botuser>'") % {:highlight => Bold}
else
return _("user topics: show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy")
end
when "auth"
return _("auth <masterpassword>: log in as the bot owner; other commands: login, whoami, permissions syntax, permissions [re]set, permissions view, user, meet, hello, allow, prevent")
when "meet"
return _("meet <nick> [as <user>]: creates a bot user for nick, calling it user (defaults to the nick itself)")
when "hello"
return _("hello: creates a bot user for the person issuing the command")
when "allow"
return _("allow <user> to do <sample command> [<where>]: gives botuser <user> the permissions to execute a command such as the provided sample command (in private or in channel, according to the optional <where>)")
when "deny"
return _("deny <user> from doing <sample command> [<where>]: removes from botuser <user> the permissions to execute a command such as the provided sample command (in private or in channel, according to the optional <where>)")
else
return _("auth commands: auth, login, whoami, who, permission[s], user, meet, hello, allow, deny")
end
end