Example:
!go #chan #chan #chan makes the bot join the specified channels.
!leave #chan #chan #chan makes the bot leave the specified channels.
on $*:TEXT:/^!(go|leave) /Si:#: {
if ($nick != BotOwnerNickHere) halt
if (!$2) { notice $nick 12Syntax: $1 $str(#chan $chr(32),3) | halt }
var %i 2 | while (%i <= $0) {
var %chan $eval($+($,%i),2)
if ($left(%chan,1) != $chr(35)) { msg # 12Invalid channel name $+(4,%chan,12.) | inc %i }
elseif ($me ison %chan) { msg # 4 $+ $v1 12is already on $+(4,$v2,12.) | inc %i }
else { $iif($regml(1) = go,join,part) %chan | inc %i }
}
}
You can place regex directly in the matchtext parameter of an event by placing a $ before the level (in this case, *) -- This will prevent the script from trying to trigger when it shouldn't, and also help avoid conflicts with other on text events in the same file:
*on $:TEXT:/^!(go|leave)$/Si:#: {**
What do you mean?