Bot auto join

By HeatedHeart on Feb 20, 2012

This is actually a snippet from a much larger project called "XeroBot" im working on. However I couldn't find a bot autojoin system on here that suited my taste's specifically, So I decided to code my own, aswell as release it here for you guys to critique/user/whatever. Everything should function correctly, had to do a LITTLE butchering to it to make it stand alone, as the full snippet use's alot of custom functions/aliase's within it. Included a simple $logo alias, as that one is easily editable. Syntax is as follows:
!Ajoin
Example: "!ajoin add #Scripting" or "!ajoin del #Scripting"

Defined Parameters:
-- Add's a channel to the autojoin list
-- Deletes a channel from the autojoin list
-- List's all channels on the auto join list
-- Add's all channels to the autojoin list that the bot is currently on
-- Removes all channels from the autojoin list (Note: The bot will not /part channels when using the clear parameter, such as it will when using the parameter)

I might refine this a bit/add more options to it at another time, for this is just a small snippet from a much larger project, but just felt like sharing it with the community.

P.S: This is my first snippet ive publicly released in over a year. Feel special :P

;########################
;##--ADV Bot CTRL V.1--##
;##---By HeatedHeart---##
;##www.XeroCreative.com##
;########################
alias Logo { return 4X14è15r0ó4B15ø14t }
;#### Channel/Query Commands
;*** Channel Commands
on 8:TEXT:!ajoin*:#:{ 
  if ($chr(35) isin $3) {
    if ($2 == add) { set %AutoJoin $addtok(%Autojoin,$3,32) | .msg $chan 14added4 $3 14to AutoJoin $logo | .join $3 | .msg $3 Channel Added To AutoJoin $logo | halt }
  }
  if ($2 == del) { 
    if ($istok(%autojoin,$3,32) == $true) { set %AutoJoin $deltok(%autojoin,$findtok(%autojoin,$3,1,32),32) | .msg $chan 14deleted4 $3 14from AutoJoin $logo | .part $3 | halt }
    if ($istok(%autojoin,$3,32) == $false) { .msg $chan 4 $3 14not found on AutoJoin $logo | halt }
  }
  if ($2 == list) { 
    var %x $numtok(%autojoin,32)
    var %Loop 1
    while (%Loop <= %x) {
      .var %z $addtok(%z,$Gettok(%autojoin,%loop,32),32)
      inc %loop
    }
    .msg $chan 14Number of Channels on AutoJoin:4 $numtok(%autojoin,32)
    if (%x == 0) { halt }
    else { .msg $chan 14 $+ %z
      halt
    }
  }
  if ($2 == cadd) { 
    var %x $chan(0)
    var %Loop 1
    while (%Loop <= %x) {
      set %AutoJoin $addtok(%Autojoin,$chan(%loop),32)
      var %z $addtok(%z,$chan(%loop),32)
      inc %loop
    }
    .msg $chan 14Added All Current Channels to AutoJoin:4 %z 14Total:4 $chan(0) 
    halt
  }
  if ($2 == clear) { 
    var %z $numtok(%autojoin,32)
    unset %autojoin | set %autojoin
    .msg $Chan 14Cleared AutoJoin, Number of Channels Removed: %z $logo
    halt
  }
  else { .msg $chan 14invalid syntax, please use:4 !ajoin 14<4add14/4del14/4list14/4cadd14/4clear14> <4#channel14> }
}
;####Events
;*** On Connect
on *:Connect: { 
  var %x $numtok(%autojoin,32)
  var %Loop 1
  while (%Loop <= %x) {
    .join $Gettok(%autojoin,%loop,32)
    inc %loop
  }
}

Comments

Sign in to comment.
DragonHeart   -  Mar 16, 2012

Can this be used across several networks? Say I wanna join #channel1, #channel2 and #channel3 on one network but only #channel4 on second network and #channel5 on third network?

 Respond  
HeatedHeart   -  Feb 24, 2012

eh. never liked timers, they feel to "clunky"

 Respond  
xplo   -  Feb 23, 2012

how about this.

.timer 1 5 join %hubchan | partall 
 Respond  
HeatedHeart   -  Feb 23, 2012

problem with the /part all (i've actually allways used /join #1,0 haha) is that how will you then communicate with the bot? unless I add Query command support.

and oshi.. yeah I took it out to make this compatable as a standalone script.. THEN decided to leave the $logo

 Respond  
xplo   -  Feb 23, 2012

Oh, and btw. your $logo alias is missing from the script. unless you forgot to remove it from the script :)

 Respond  
xplo   -  Feb 23, 2012

Maybe you can add the /partall command to the CLEAR command?

 Respond  
Stewie1k94   -  Feb 22, 2012

Nice Script.

 Respond  
HeatedHeart   -  Feb 22, 2012

Thanks =]

 Respond  
kushman420TC   -  Feb 22, 2012

Pretty usefull, will say dont think I'll use it because of a script I use at the moment. But this woulda been very helpfull like a year ago. 9/10 for me :]

 Respond  
HeatedHeart   -  Feb 20, 2012

A rating but no comment! jerk! :P

 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.