When Someone Deop You, With This Snippet You Can Automatically Reop.
&
When Some one Ban You, With This Snippet You Can Automatically Unban.
<<Reop When Deoped>>
on 1:DEOP:#chan:{
if ($opnick == $me) {
cs op $chan
}
}
<<Unban when Ban>>
on @1:BAN:#chan:{
if ($banmask iswm $ial($me)) {
mode $chan -b $banmask
}
}
That regex is to match the mode +b, (we don't want it to trigger upon -b so it has to be negated using the ^ sign) where $2 is the string of nick or ident banned under the rawmode event. In this case, we want to watch out for someone who sets a ban on the client that runs the code. The $ial($me) returns the whole address from the internal address list, sort of like $fulladdress or $address($2,5). The iswm operator is used so we can match it as a wildcard string. Once a ban is set on the client, the code will immediate get the ban unset. It doesn't matter if it's a nick, ident or host ban. The code will reverse the action.