on OP/DEOP

 

The on OP and on DEOP events trigger when a user on a channel is opped or deopped.

 

Format:        on <level>:OP:<#[,#]>:<commands>

Example:        on 1:OP:#mirc,#irchelp:/msg $opnick Please do not abuse your Op status

 

The on VOICE/DEVOICE and on HELP/DEHELP events use the same format and trigger when a user is voiced/devoiced or helped/dehelped respectively.

 

The on SERVEROP event also uses the same format and triggers when a user is opped by a server.

 

The on RAWMODE event triggers independently of these events and allows you to parse the raw mode line yourself.

 

Examples

 

on 9:OP:#:/mode $chan -o $opnick

on 9:VOICE:#:/mode $chan -v $vnick

on 9:HELP:#:/mode $chan -h $hnick

 

This triggers when a user with access level 9 is opped/voiced/helped on any channel. $opnick refers to the nickname of the person being opped/deopped, $vnick the person being voiced/devoiced, and $hnick the person being helped/dehelped.

 

on 1:DEOP:#beginner:/mode $chan +o $opnick

 

This triggers when any Op is deopped on channel #beginner.

 

on 1:SERVEROP:#:/mode $chan -o $opnick

 

This triggers when an irc server ops a user on any channel. You immediately deop them.

 

The $modefirst and $modelast identifiers return $true or $false depending on whether the event is the first or last to trigger.

 

Comparing levels

 

You can compare the levels of the opper and the opped by prefixing the line with <,>,<=,=>,<>, or =, in the following way:

 

on >=1:DEOP:#mIRC:/msg $chan $nick deopped $opnick (legal)

on 1:DEOP:#mIRC:/msg $chan $nick deopped $opnick (illegal)

 

In this situation, if the deoppers level is greater than or equal to the deopped users level, then it is a legal deop. Otherwise, it defaults to the second line which indicates that it is an illegal deop. Remember, this is comparing the oppers and opped users levels and has nothing to do with the level 2 in the definition.

 

Note: These events only work on nicknames because the IRC server only sends the nickname of the user being affected and not their address.

 

on RAWMODE

 

on @1:RAWMODE:#:/echo $chan Raw mode line: $nick set $1-

 

The on RAWMODE event allows you to parse the raw mode change yourself, the raw mode text is in $1-.

 

You can use the $mode(N) identifier with these events to list the nicks that are being affected.