Skip to content

Instantly share code, notes, and snippets.

@kythyria
Created January 19, 2015 09:13
Show Gist options
  • Save kythyria/9087cabfd73b73864262 to your computer and use it in GitHub Desktop.
Save kythyria/9087cabfd73b73864262 to your computer and use it in GitHub Desktop.
Command discovery?

When prompted (or when it feels like) the server sends RPL_COMMANDUSAGE:

RPL_COMMANDUSAGE <command> <context> <parameter1> <parameter2> ...

command is the verb in question. context is a hint as to what UI element to attach the command to, or what arguments to deduce when the user enters the command as text.

channel     | Any channel
nick        | Any nick
nickchan    | Nick in a channel
target      | Nick or channel, or possibly a targetlist.
self        | The user issuing the command
other       | Some other context

parameters are like <type>:<name> or <type>:<name>:c, with the :c indicating the client should try to draw this from context.

label       | Not actually parameter. UI text to display for this command.
sc          | Subcommand; literal text to include to invoke this one.
chan        | Channel name
nick        | Nickname
user        | Services username (which is usually a nick)
target      | Nick or channel, or possibly a targetlist.
hostmask    | Hostmask.
o           | Other parameter
text        | Long text (must be the last non-label parameter!)

So we get, assuming 2xx is the numeric:

2xx PRIVMSG target target:destination:c text:message
2xx KICK nickchan chan:channel:c nick:nick:c text:reason
2xx MODE channel chan:channel:c sc:+b label:Ban
2xx MODE nickchan chan:channel:c sc:+o nick:c :label:Give op
2xx MODE nickchan chan:channel:c sc:-o nick:c :label:Take op
2xx ZNC channel sc:detach chan:channel:c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment