Skip to content
Eric Mertens edited this page Aug 8, 2021 · 3 revisions

The macros configuration section allows you to define sequences of commands. These commands can contain expansions.

Configuration

  • name - text - name of macro
  • arguments - text - space separated list of argument names (suffix name with ? when optional)
  • commands - list of text - commands to send after expansion

Macro Expansions

Variable names and integer indexes can be used when defining commands. Variables are specified with a leading $. For disambiguation a variable name can be surrounded by {}. $channel and ${channel} are equivalent. Default values can be provided following a pipe: ${var|default}.

  • channel - current channel
  • network - current network name
  • nick - current nickname

The arguments to a command will be mapped to integer indexes.

  • 0 - first argument
  • 1 - second argument (etc.)

Examples

macros:
  * name: "clearbuffers" -- note: recent ZNC has clearallbuffers
    commands: * "znc *status clearallchannelbuffers"
              * "znc *status clearallquerybuffers"

  * name: "lua"
    arguments: "args*"
    commands: "extension Lua $0" -- note: single commands don't need a list (>= 2.28)

  * name: "removeban"
    arguments: "nick reason*"
    commands: * "mode b $0!*@*" -- note: just an example, this isn't a good mask
              * "remove $0 $1"