Alias block

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

Syntax[edit]

Standard alias[edit]

alias <name> {
	target <nick-to-forward-to>;
	type <type-of-alias>;
	spamfilter <yes|no>;
};

(Note that <name> is referred to using "alias::")

(Note: see a description of the standard alias files UnrealIRCd has)

The alias block [standard alias] allows you to forward a command to a user, for example /chanserv sends a message to the user chanserv.

alias:: specifies the name of the command that will be the alias (eg: chanserv)

alias::target is the nickname or channel it will forward to. If alias:: would be the same as the target, alias::target may be left out.

alias::type specifies the type of alias, valid types are

  • services (the user is on the services server),
  • stats (the user is on the stats server),
  • normal (the user is a normal user on any server),
  • channel (the target is a channel name), and
  • command (this is not a "standard alias", see below).

alias::spamfilter (optional) causes the spamfilters will be checked if set to "yes" (default is 'no').

Command alias[edit]

alias <name> {
	/* For aliases to be sent to users/channels */
	format <regex-expression> {
		target <nick-to-forward-to>;
		type <type-of-alias>;
		parameters <parameter-string>;
	};
	/* For 'real aliases' */
	format <regex-expression> {
		command <command>;
		type real;
		parameters <parameter-string>;
	};
	/* Etc... You can have as many format blocks as you wish.. */
	format <regex-expression> {
		...
	};
	type command;
	spamfilter <yes|no>;
};

When an alias block has alias::type set to command, as shown above, it becomes a command alias. When the alias block is used in this format, it is much more flexible. For example, you could create an /identify alias.

alias:: is the name of the alias command as in standard alias block form (above).

alias::format specifies a regular expression which is matched against the text sent to the alias command. The sub-entries of the first matching alias::format will be used. Thus, you may have multiple alias::formats to make a command do different things depending on the text sent to it.

alias::format::target is the target to forward this alias to. This value is not used if alias::format::type is "real".

alias::format::type specifies the type of the alias that the message should be forwarded to. In addition to the types mentioned previously in "Syntax [standard alias]", "real" may be specified here for a "real alias" (a "real alias" is an alias that may be rewritten to something other than a PRIVMSG).

alias::format::parameters (for "real aliases") is what will be sent as the parameters to this alias. To specify one of the parameters given to the command alias specify % followed by a number. For example, %1 is the first parameter. To specify all parameters from a given parameter to the end, use % followed by the number and a -. For example, %2- returns all parameters from the second through the last. Additionally, you may specify %n which will be replaced by the nickname of the user who executed the command.

For examples of using the alias block in the command format, see aliases/*.conf.