!join and !part channel

By Keon191 on May 30, 2010

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 } 
  }
}

Comments

Sign in to comment.
Keon191   -  Jul 22, 2010

the reason $nick is used is because on justin.tv the user almost always has a channel. and the channel has the same name as the user so like my channel is keon191 and my username is keon191 so /join $nick works on justin.tv but you can also use !join #channel. either one works.

 Respond  
Jonesy44   -  Jun 04, 2010

That's the one i meant :) hence the me saying i think \w isn't whitespace last message :p

 Respond  
Jethro   -  Jun 03, 2010

jonesy, using \w is not a good idea, because if a channel consists of a special character or some sort of a punctuation mark, the regex won't recognize it. You will have to use \S

Notice that's a capital letter s. The lower one represents a space.

 Respond  
Jonesy44   -  Jun 03, 2010

True, infact the # isn't even required on second thought, since /join lobby has the same effect of joining #lobby.

/^[`.!@]((join|part) \w*)$/Si

Although i can't remember the character code for alphanumeric-characters. I think \w is not whitespace but i'm not too sure

 Respond  
Jethro   -  Jun 02, 2010

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...

 Respond  
Jonesy44   -  Jun 02, 2010
on $*:text:/^[`.!@]((join|part) #?.*)$/Si:#:$regml(1)

I'd do it pretty much the same way as napa..

 Respond  
Jethro   -  Jun 02, 2010

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.

 Respond  
Bielie   -  Jun 02, 2010

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 }
 Respond  
Jethro   -  May 30, 2010

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)
  }
}
 Respond  
Cheiron   -  May 30, 2010

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)

 Respond  
Jonesy44   -  May 30, 2010

Ahh Sorry! i missed the outer brackets, i thought $regml(1) was responding to (join|part) lol. My bad

 Respond  
napa182   -  May 30, 2010

lol i didnt see that he used $nick . don't know why they used $nick maybe a typo?

anyways the way i did it is it wont work unless #chan_name is added
ex @join #Chan_Name and @part #Chan_Name

 Respond  
Jonesy44   -  May 30, 2010

You sure about that napa?? Also, this script has a pretty hefty fault. "join $nick".. joins the name, if the channel exists fair enough..

Napa, your script would just execute the cmd "join/part" no?:L

 Respond  
napa182   -  May 30, 2010

you could do something like this

on $*:text:/@((join|part)\s\43\S+)/iS:#:$regml(1)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.