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
>Wug m version correction |
>Mkaysi m It's ZNC 1.6.0, not 1.6 |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:alias}} | {{DISPLAYTITLE:alias}} | ||
{{Core Module | version = 1. | {{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 === | ||
* 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 a part of ZNC. This module is shipped with ZNC by default. If you have the right "LoadMod" you can activate it with /znc LoadMod alias The code for this module can be found here. This module is part of ZNC since Version 1.6.0 |
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.