ajoin-system for bot

By PowerScripters on Jan 09, 2010

Don't have trouble with your Bot.
Easy Autojoin & Control-Function.

Syntax: !ajoin [add/del] #channel
Syntax: !ajoin [list] - For a list of all Channels
Syntax: !ajoin [activate] module
Syntax: !ajoin [activate] !module

###################
Modules:
You can activate Modules for moer Functions, there is 1 Module actually installed
"join::mode" - If this Module is enabled, the bot joins the channel added to the Autojoin-List.

Example. Your Bot is in #room
Now you type: !ajoin add #room2

  • If "join::mode" is activated, he automatically joins the channel and leaves a welcome Message there.

##################
You can deactivate Modules typing !ajoin [activate] !join::mode

Remember to set Admin-Level before using.

  • Requires Level: 20.
// !ajoin [add/del/list/activate] <channel/module>
// $2 = command, $3 = channel. [default]
on ^10:TEXT:!ajoin*:#:{
  if ($2 == add) { 
    if (!$3) { msg $chan Syntax: !ajoin add <channel> - you are doing it wrong | halt }
    if (%join.channel.if.not.exists% == true) {
      var %i 1
      while (%i <= $chan(0)) {
        if ($chan(%i) == $3) { var %cache.join xtrue }
        inc %i
      }
      if (%cache.join != xtrue) { msg $chan .. joining channel $3 | join $3 | .timer 1 3 msg $3 Heya Guys, whats up? }
    } ; type: !ajoin activate join::mode

    var %i 1
unset %cache.chan.exists
    while (%i <= $lines(ajoin.list)) {
      if ($read(ajoin.list,%i) == $3) { set %cache.chan.exists xtrue }
      inc %i
    } ; checks if the channel was already added
    if (%cache.chan.exists == xtrue) { msg $chan I have this Channel already in my list | halt }

    write ajoin.list $3
    msg $chan Channel $3 added for autojoin!
  }
  elseif ($2 == del) {
    if (!$3) { msg $chan Syntax: !ajoin del <channel> - you are doing it wrong | halt }
    var %i 1
    while (%i <= $lines(ajoin.list)) {
      if ($read(ajoin.list,%i) == $3) { var %x-cache.chan.exists xtrue }
      inc %i
    } ; checks if the channel exists
    if (%x-cache.chan.exists != xtrue) { msg $chan The Channel: $2 isn't in my Autojoin-List. | halt }
    var %i 1
    write -c cache.txt
    while (%i <= $lines(ajoin.list)) {
      write cache.txt $remove($read(ajoin.list,%i),$3)
      inc %i
    }
    msg $chan Refresh autojoin list..
    .remove ajoin.list
    .copy cache.txt ajoin.list
msg $chan Channel $3 was successfully 
  }
  elseif ($2 == list) {
    var %i 1
    var %ticks-1 $ticks
    while (%i <= $lines(ajoin.list)) {
      msg $chan  %i $+ : $read(ajoin.list,%i)
      inc %i
    }
    var %ticks $calc($ticks - %ticks-1)
    msg $chan Loading autojoin list in $round($calc(%ticks / 1000)) seconds.
  }
  elseif ($2 == activate) {
    if (!$3) { msg $chan Syntax: !ajoin avtivate <module> | halt }
    if ($3 == join::mode) { set %join.channel.if.not.exists% true | msg $chan Added Module: join::mode // Joins a Channel if the Channel is added to autojoin list [type: !ajoin activate !join::mode] to deactivate | halt }
    elseif ($3 == !join::mode) { unset %join.channel.if.not.exists% | msg $chan Removing Module: join::mode | halt }
    else { msg $chan Module $3 wasnt found! :( | halt }
  }
  elseif ($2 == clear) {
    msg $chan Clearing autojoin-script - make backup..
    .copy ajoin.list ajoin.list.bak
    .remove ajoin.list
    write -c ajoin.list
msg $chan autojoin-list cleared.
  }
  elseif ($2 == help) {
    .notice $nick Autojoin-Script © PowerScripters 
    .notice $nick Syntax: !ajoin add <channel> to add a channel.
    .notice $nick Syntax: !ajoin del <channel> to del a channel.
    .notice $nick Syntax: !ajoin clear to clear all channels     
    .notice $nick Syntax: !ajoin <list> to list all Channels
    .notice $nick Autojoin can used by Admins
    halt
  }
  else { msg $chan debug> you have entered $2 - [noreturn] | halt }
}
on *:CONNECT:{ .timer 1 3 do.autoconnect } ; wait 3 seconds to avoid connection pingouts.
alias -l do.autoconnect {
  var %i 1
  while (%i <= $lines(ajoin.list)) {
    join $read(ajoin.list)
    inc %i
  }
}
on ^20:TEXT:!add_user*:#:{
  ; admin-level - 20
  if (!$2) { msg $chan you need to add a username | halt }
  else { .guser 10 $2 | msg $chan Added $2 with Access 10. }
}
on ^20:TEXT:!remove_user*:#:{
  ; admin-level - 20
  if (!$2) { msg $chan you need to add a username | halt }
  else { .ruser $2 | msg $chan Removed $2 from Access List }
}

Comments

Sign in to comment.
bandbonjtv   -  Sep 19, 2012

thank you

 Respond  
troll   -  Apr 21, 2011

i dont think it works
not for me ?

 Respond  
napa182   -  Jan 09, 2010

eidted: you should work on it abit more.

 Respond  
Shinybot   -  Jan 09, 2010

Nice Script Very usefull i use it now :)

 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.