Join Channels

By Yoinx on Jan 06, 2005

This snippet is requested quite a bit. Use !join #channel to make the bot join your channel. !part #channel to make it part your channel. if the user leaves the control channel the bot leaves their channel. Op
s in the control chan can make it part joined channes and can ban it from joining channels. !banchan #channel !unban #channel Hope this helps people. Also, other than ops... only the person that made the bot join their channel can make it part their channel. Paste this in a .mrc file and load it. Or else you'll have to do /jc.start (no need to edit anything but the messages)

on *:start: {
  jc.start
}
alias jc.start {
  if ( %control.chan == $null ) {
    set %control.chan $$?="Enter Your bot's Control Channel:"
  }
  join %control.chan
}

on *:text:*:%control.chan: {
  if ( $1 == !join ) {
    if ( $2 == $null ) { 
      .msg $chan $nick You must specify a Channel for me to join.
    }
    elseif ( $2 ischan ) { 
      .msg $chan $nick Sorry, I'm already on that Channel.
    }
    elseif ( $($+(%,banned.,$2),2) != $null ) { 
      .msg $chan $nick Sorry, I'm prevented from joining that Channel. 
    }
    elseif ( $left($2,1) == $chr(35) ) || ( $left($2,1) == $chr(38) ) {
      set $+(%,join.,$2) $nick
      .join $2
    }
  }
  if ( $1 == !part ) {
    if ( $2 ischan ) && ( $nick == $($+(%,join.,$2),2) ) || ( $nick isop $chan ) {
      .part $2 Part Requested by $nick
      unset $+(%,join.,$2)
    }
    elseif ( $2 !ischan ) {
      .msg $chan $nick I'm not Currently on that Channel.
    }
    elseif ( $nick != $($+(%,join.,$2),2) ) {
      .msg $chan $nick Sorry. Only the nick that requested that I joined $2 can request that I part it. Requested by $($+(%,join.,$2),2)
    }
    elseif ( $2 == $null ) {
      .msg $chan $nick Please Specify a Channel.
    }
  }
  if ( $1 == !banchan ) {
    if ( $nick isop $chan ) {
      if ( $2 == $null ) {
        .msg $chan $nick You must specify a Channel to ban.
      }
      elseif ( $($+(%,banned.,$2),2) == $null ) && ( $left($2,1) == $chr(35) ) || ( $left($2,1) == $chr(38) ) {
        set $+(%,banned.,$2) banned
        if ( $2 ischan ) {
          .part $2 This channel has been banned from me joining.
        }
      }
      elseif ( $($+(%,banned.,$2),2) != $null ) {
        .msg $chan $nick $2 is already a banned channel.
      }
    }
  }
  if ( $1 == !unbanchan ) {
    if ( $nick isop $chan ) {
      if ( $2 == $null ) {
        .msg $chan $nick You must specify a Channel to ban.
      }
      elseif ( $($+(%,banned.,$2),2) != $null ) {
        .unset $+(%,banned.,$2)
        .msg $chan $nick $2 has been Unabanned
      }
      elseif ( $($+(%,banned.,$2),2) == $null ) {
        .msg $chan $nick $2 is not banned.
      }
    }
  }
}
on *:part:%control.chan: {
  var %x 1
  while ( %x <= $var(%join.*,0) ) {
    if ( $nick == $($var(%join.*,%x),2) ) {
      .part $deltok($var(%join.*,%x),1,46) $($var(%join.*,%x),2) Parted my control Channel. You must be in it to keep this bot in your channel.
      $($var(%join.*,%x))
    }
    inc %x
  }
}
on *:QUIT: {
  var %x 1
  while ( %x <= $var(%join.*,0) ) {
    if ( $nick == $($var(%join.*,%x),2) ) {
      .part $deltok($var(%join.*,%x),1,46) $($var(%join.*,%x)) Quit my control Channel. You must be in it to keep this bot in your channel.
      unset $($var(%join.*,%x))
    }
    inc %x
  }
}

Comments

Sign in to comment.
nexusfn   -  Oct 08, 2010

Hi, I have problems with the servers, the problem is the redirect ... It would need a command like this: !Go + nick + server ..... To redirect it to each channel

alias getConnection {
  ; Parameter $1 is the full IP address of a server Ex: 199.9.249.8
  ; Returns the server connection id that server IP is located.

  var %numConnections = $scon(0)
  var %serverIncrement = 1

  ; Which connection is the server located?
  while (%serverIncrement <= %numConnections) {
    if ($scon(%serverIncrement).$serverip == $1) {
      return $scon( [ $+ [ %serverIncrement ] ] )
    }
    else {
      inc %serverIncrement
    }
  }
}

raw REDIRECT:*:{
  scid $getConnection($2) join -n $1
}

Images to better understand:

1_ http://i1135.photobucket.com/albums/m633/nexusfn/AYUDA1-1.jpg?t=1286595306
2_ http://i1135.photobucket.com/albums/m633/nexusfn/AYUDA2-1.jpg?t=1286595315
3_ http://i1135.photobucket.com/albums/m633/nexusfn/AYUDA3-1.jpg?t=1286595313

 Respond  
AdamRock   -  Sep 27, 2008

Nice script, can you make/edit a new script like this but instead of a control channel, the user can say !join #channel inside any chat

 Respond  
Kkkimpa   -  Jan 25, 2006

Hi. I just cant get this thing work. I do just have to fill in #MyChannel right, but when i load the script, it isn\'t happen anything. Or, ppl can\'t tell my bot to !join #TheirChannel, what am i doing wrong, thnx for answer.

 Respond  
HeX   -  Jan 22, 2005

10 to just to bad it causes a problem with youre other *:TEXT commands

 Respond  
SilverZone   -  Jan 10, 2005

Yoinx This Script Is Very Nice :) I have gived a 10 This is usefull for peaple that needs a join/part command ;-)

 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.