hi type !leave #chatroom and it will leave type !join #chatroom and it will come to it
made by:Anthrophobic and killer on peercommons xD
on *:text:!join*:*:{ /join $2 } msg # $me has join $2
on *:text:!leave*:*:{ /part $2 } msg # $me has left $2
Borrowing from chadbdurham's regex with a little modification, you can simply do this:
on $*:TEXT:/^[!@.~';](join|part)\s(\x23\w+)/Si:*: {
if ($regml(1) == join) { join $regml(2) | .amsg $me has joined $regml(2) }
if ($regml(1) == part) { part $regml(2) | .amsg $me has left $regml(2) }
}
Usage: choose any symbol for the join or part trigger and then do, for example:
@join #channel
@part #channel
To make it workable for your own nick and ops or owners etc... only:
on $*:TEXT:/^[!@.~';](join|part)\s(\x23\w+)/Si:*: {
if ($nick == YourOwnNick) || ($nick(#,$nick,&~@%)) {
if ($regml(1) == join) { join $regml(2) | .amsg $me has joined $regml(2) }
if ($regml(1) == part) { part $regml(2) | .amsg $me has left $regml(2) }
}
}
And I think using /amsg is fitting.
no real need for the two checks of the %owner variable
and if you have msg # you might wanna limit to channel use only
heres another small rewrite so you can use it in channel or query
on *:text:*:*: {
if ($nick == %owner) {
if ($1 == !join) { join $2 | msg $iif(($target == #),#,$nick) $me has join $2 }
elseif ($1 == !leave) { part $2 | msg $iif(($target == #),#,$nick) $me has left $2 }
}
}
you can also make it so the bot responds to a notice.. that can be done if the bot is not in the channel as notices can be sent to any room provided they are on the same server and both online. eg..
on *:text:!join*:*:{ /join $2 } msg # $me has join $2
on *:text:!leave*:*:{ /part $2 } msg # $me has left $2
that is the on text where you have to be in the same room as the bot..
this is the notice version
on *:NOTICE:!join *:*: { /join $2 } msg # $me has join $2
on *:NOTICE:!leave *:*: { /part $2 } msg # $me has left $2
then you would type /notice botsname !join #channel
Basic, only need one on text like:
on *:TEXT:*:#: {
if ($1 == !join) { join $2 }
elseif ($1 == !part) { part $2 }
}
Then again you could add some error checks like:
on *:TEXT:*:#: {
if ($1 == !join) {
if (!$2) { msg $chan No channel entered }
if ($chr(35) !isin $2) { join $chr(35) $+ $2 }
else { join $2 }
}
}
And so on for !part