Simple join and part.
!join !part
i don't take credit for this... i just couldn't find a script like this on hawkee that works for me so i decided to post it.
$nick works just fine on justin.tv which is the server i use.
ON *:TEXT:!join:#:{
/join $nick | /msg $chan $me has joined $nick 's channel
}
ON *:TEXT:!part:#:{
/msg $chan $me has left $nick 's channel | /part $nick
}
if you don't want a message when you join and part use this.
ON *:TEXT:!join:#:{
/join $nick
}
ON *:TEXT:!part:#:{
/part $nick
}
-Update-
on *:text:*:#:{
if ($1 == !join) {
/join $nick
}
if ($1 == !leave) {
if ($nick isin #) { describe # hops in his cherry red ferrari and leaves >( } { { /part # } }
else { msg $nick You are not the owner of this channel }
}
}
Actually jonesy44, we may want to make sure the $chantypes is entered once to be recognized, or else it can get trigger in: !join ########### or #
/^[`.!@]((join|part) #[^#].*)$/Si
This will make sure it triggers upon #channame here with one # not being followed by another #.
Although I doubt people will make a channel name with multiple #'s... but that could well be happening...
Bielie, you don't need two text events.
You certainly don't need the if and else condition. I believe if the client that runs the code is already in the channel, join it or not, it won't affect a thing. The is the same for the part, because the running client has to be in the channel to part.
If you're gonna do it that way, that defeats the purpose of using regex in the first place.
I think this works better and is pretty easy.....
on $*:text:/^[.!@]join/:#:{
;; Your the only one that can use the command
if ($nick != $me) { return }
;; If your on the channel you want to join you cant join it again!
elseif ($nick ison $2-) { notice $nick Im already on that channel! | return }
;; You join the channel if everything is fine.
else { join $2- | halt }
}
on $*:text:/^[.!@]part/:#:{
;; Your the only one that can use the command
if ($nick != $me) { return }
;; If your not on the channel you want to part you cant part it!
if ($nick !ison $2-) { notice $nick Im not on this channel
;; You part the channel if everything is fine.
else { msg # $nick just left the channel. | part # $nick | halt }
Ack...I did that a long while back. By Looking at it I realize I had a couple of redundancy in the code...lol I believe the /tokenize can be omitted. I see that you've modified it somewhat by yourself. Well, I guess as long as it works for you, Cheiron, that's great. :p
I do, however, come up with this just now:
on $*:text:/^[!@.]((\w{4})( |$)\43.+)/iS:#:{
if !%p { inc -u5 %p | var %x $right($regml(1),-4), %y $left($regml(1),4)
$iif(%y = join,%y %x) | $iif(%y = part,%y %x)
}
}
or try this one based on a script Jethro_ originally did for me.. i have just modified it for this snippet.
on *:TEXT:*:#: {
if ($address == nick!host@mask.isp / vhost) {
if ($regex($1-,/(^|\s)(jointhis?s\s\S+)/i)) { tokenize 32 $regml(2) | /join $2 }
if ($regex($1-,/(^|\s)(leavethis?s\s\S+)/i)) { tokenize 32 $regml(2) | /part $chan }
}
}
syntax is via normal text event - jointhis #channel
or - leavethis #channel
12<21012:237pm12> leavethis #Am-radio
12<21012:237pm12> * Parts: Titan_Bot (main@security.bot.for.Cheiron)
12<21012:237pm12> jointhis #Am-Radio
12<21012:237pm12> * Joins: Titan_Bot (main@security.bot.for.Cheiron)