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: Difference between revisions

From ZNC
Jump to navigation Jump to search
Ben (talk | contribs)
→‎Limitations: - 1.5+ doesn't have that limitation. https://github.com/znc/znc/commit/e7b0138a09f7bf8390cadd60b8a2b3c7751b7920
>Mkaysi
m It's ZNC 1.6.0, not 1.6
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:alias}}
{{DISPLAYTITLE:alias}}
{{Core Module | version = 1.6}}
{{Core Module | version = 1.6.0}}
This module is used to create named command aliases on ZNC, that any connected client can use.
This module is used to create named command aliases on ZNC, that any connected client can use.


Line 41: Line 41:
   
   
=== Limitations ===
=== Limitations ===
* In ZNC 1.4 and earlier, it's not possible to use the alias module to provide shorthand for ZNC features, such as commands to *status.  ZNC 1.5 and later does not have this limitation.
* 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.
* 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.

Latest revision as of 21:22, 21 February 2015

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.