To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

alias

From ZNC
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This module is used to create named command aliases on ZNC, that any connected client can use.

Usage

Arguments

This user module takes no arguments.

Read loading modules to learn more about loading modules.

Commands

To view documentation about alias' commands, issue the following:

/msg *alias help

Add and Insert take an action parameter which is used as a template command. Valid substitutions in this parameter can include ExpandString tokens, as well as tokens of the format %N%, N being the index of the argument passed to the alias at the time of use. Additionally, you can precede N with a question mark (?) to make it an optional parameter, and you can follow N with a plus sign (+) to include all arguments from N onward instead of just the Nth. N is indexed at zero, so %0% is the first token received (which will be the name of the alias).

<Wug> CREATE aliasdemo
<*alias> Created alias: ALIASDEMO
<Wug> ADD aliasdemo PRIVMSG %nick% :%1+%
<*alias> Modified alias.
<Wug> ADD aliasdemo NOTICE %nick% :%1+%
<*alias> Modified alias.
<Wug> INFO aliasdemo
<*alias> Actions for alias ALIASDEMO:
<*alias> 0   PRIVMSG %nick% :%1+%
<*alias> 1   NOTICE %nick% :%1+%
<*alias> End of actions for alias ALIASDEMO.
<Wug> INSERT aliasdemo 0 JOIN #Wug
<*alias> Modified alias.
<Wug> REMOVE aliasdemo 1
<*alias> Modified alias.
<Wug> INFO aliasdemo
<*alias> Actions for alias ALIASDEMO:
<*alias> 0   JOIN #Wug
<*alias> 1   NOTICE %nick% :%1+%
<*alias> End of actions for alias ALIASDEMO.

Use aliases as though they were server commands. Missing parameters will be passed as an empty string if they are optional, and will generate a 461 numeric (ERR_NEEDMOREPARAMS) otherwise.

/aliasdemo This is a test    #valid, %1+% expands to "This is a test"
/aliasdemo                   #generates a 461, since required token %1+% is missing

Limitations

  • It is impossible for ZNC to know which channel the user is viewing, so there is no %channel% substitution. It's tough to work around this problem, but future versions may support interacting with a client side script that informs ZNC of the user's currently active channel.