sBNC bot script

By xelent on Apr 10, 2010

Advanced sBNC bot script made by xelent - If you wanna run 2 bots with same script, remember to change the %sbnc(trigger) on the other bots. %sbnc(global) gives you the ability to control both.

  • Multitasking feature tba.
  • Conversion from msl to tcl tba.

    ------>
    set %sbnc(mchan) #MAINCHANNEL
    set %sbnc(pchan) #ADMINCHANNEL
    set %sbnc(ircserver) IRC SERVER IP
    set %sbnc(port) IRC PORT
    set %sbnc(server) SBNC SERVER IP
    set %sbnc(author) xelent
    set %sbnc(realname) sBNC by: #MAINCHANNEL - HOMEPAGE
    set %sbnc(version) 2.0
    set %sbnc(receiver) -sBNC
    set %sbnc(trigger) !
    set %sbnc(global) ?
    <------

Edit these variables only! (You'll find these twice, look over the script).

These commands is available for you (Admin)
!sbnc add [nick] - Adds one bnc with for [nick].
!sbnc del [reason] - Removes the bnc with [reason].
!sbnc check <nick/identd> - Checks if <nick/identd> isin database.
!sbnc stats - Shows current statistics of database.
!sbnc join - Simulates all bouncers to mainchan.
!sbnc on/off/error - Enable,disable or error the bnc request.
!sbnc jump - Reconnects to current server.
!sbnc suspend [nick] (reason) - Suspends [nick] with with (reason) from from server.
!sbnc unsuspend - Unsuspends from from server.
!sbnc reset [nick] - Gives active a new password, sent to [nick].
!sbnc warn [reason] - Warn that he is about to loose hes sBNC due violation with [reason]
!sbnc never - Returns the syntax to remove identds that never has been connected.
!sbnc addadmin - Gives the admin access if it is registrated.
!sbnc deladmin - Removes the admin access if it is registrated.

These commands are availible for all users on #MAINCHANNEL
!bnc (User have to be authed and will get question regarding his bnc).

REMEMBER TO SET VARIABLES in on :load:{
and on
:connect:{

More to come aswell, just dont have time for the time being. Leave any questions in the comment fields and I will try answering them.

# Copyright© 2009-2013 by Andreas 'xelent' Moen - figo@online.no 
# All rights reserved. 
# 
# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following conditions 
# are met: 
# 
#   * Redistributions of source code must retain the above copyright 
#     notice, this list of conditions and the following disclaimer. 
#   * Redistributions in binary form must reproduce the above copyright 
#     notice, this list of conditions and the following disclaimer in the 
#     documentation and/or other materials provided with the distribution. 
#   * The name of the author may not be used to endorse or promote products 
#     derived from this software without specific prior written permission. 
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
# POSSIBILITY OF SUCH DAMAGE. 
#
# This source is still under developement, this source might contain corrupted data.
# OFFICIAL RELEASE DATE: Private use only
# Project ID: #52
# Executive Tech Developer: Andreas 'xelent' Moen
# Designed for the sbnc (2.0) CORE™

on *:disconnect:{
  hsave slist sbnc\data\slist.dat
  hfree auth
  hfree test
  hfree slist
}

on *:EXIT:{
  hsave slist sbnc\data\slist.dat
  hfree auth
  hfree test
  hfree slist
}

raw 354:*135*: {
  /hadd auth $3 $4
}

raw 354:*134*: {
  /hadd test $4 $3 
}

alias never {
  .msg %sbnc(receiver) who
}

alias check {
  if ($slist($1)) { 
    .ban %sbnc(mchan) $test($1)
    .kick %sbnc(mchan) $1 You are suspended from our sBNC service.
    .putmsg ( 7Information: ) If you have questions about your suspension or you mean this action was done wrong. Contact us at www.gamepark.se
    .msg %sbnc(pchan) ( 7Information: ) Banned $1  ( $+ $slist($1) $+ ) from %sbnc(mchan) due suspension.
  }
  elseif (!$slist($1)) { 
    timer 1 2 bnc $1
  }
}

alias unused {
  if ($lines(sbnc\data\unusedbncs.txt)) {
    /play %sbnc(pchan) $qt($mircdir $+ sbnc\data\unusedbncs.txt)
    /remove sbnc\data\unusedbncs.txt
    /clear - -sbnc
  }
  else {
    .msg %sbnc(pchan) None 'NoN-used' bncs found.
  }
}

on *:text:*Never*:?:{
  .write sbnc\data\unusedbncs.txt !sbnc del $gettok($1,1,40) Never connected
}

alias bnc { 
  /filter -ff sbnc\data\database.ini active.txt *active* {
    if ($lines(active.txt) != %sbnc(slots)) {
      if ($readini(sbnc\data\registration.ini,reg,status) == on) { 
        if ($auth($1)) { 
          .set -u600 %regist. [ $+ [ $1 ] ] 1 
          .putmsg %sbnc(pchan) Registration: ( $1 ) Would like to register as sBNC customer. ( Waiting for rules confirmation and identd ) 
          .putmsg $1 ( 7Information: ) To become a sBNC user, you must read and follow the rules.
          .putmsg $1 ( 7Information: ) Read the rules at: http://www.scrubnub.com/rules.html
          .putmsg $1 ( 7Information: ) Violation of rules will lead to a permanent suspension! 
          .putmsg $1 ( 7Information: ) To confirm, type "/msg $me .rules confirm". 
          .putmsg $1 ( 7Information: ) You have 10 minuites to confirm the rules
        }
        elseif (!$auth($1)) { 
          .putmsg $1 ( 7Information ) Sorry, pal.. you need quakenet authentication to use our services.
        } 
      }
      elseif ($readini(sbnc\data\registration.ini,reg,status) == off) {  
        .notice $1  $+ %sbnc(mchan) sBNC: sBNC service is closed. Please try again later!  
      }
    }
    elseif ($lines(active.txt) == %sbnc(slots)) {
      .putmsg %sbnc(pchan) ( 7Information: ) ( $1 ) Just tried to use our sBNC system, but unfortunately we're out of slots.
      .notice $1 ( 7Information: ) Unfortunately, but we dont have anymore BNC's to give out. Try agian later (We're daily/weekly) clearing the server for idlers and inactive users)
    }
    /remove active.txt
  }
}
alias auth {
  return $hget(auth,$1)
} 

alias slist {
  return $hget(slist,$1)
} 

alias test {
  return $hget(test,$1)
} 

alias suspend {
  if ($1 ison %sbnc(mchan)) {
    /hadd slist $1 $2
    .mode %sbnc(mchan) +b $2
    .kick %sbnc(mchan) $1 You have been suspended from our services
    .msg %sbnc(pchan) ( 7Information ) Banned $1  ( $+ $slist($1) $+ ) from %sbnc(mchan) due suspension.
  }
  elseif ($1 !ison %sbnc(mchan)) {
    .msg %sbnc(pchan) ( 7Information: ) Unable to kick $1 from %sbnc(mchan) user wasn't is not on chan.
  }
}

alias putnotice { 
  if (!$isid) { 
    putcmd .notice $1- 
  } 
} 
alias putmsg { 
  if (!$isid) { 
    putcmd .msg $1- 
  } 
} 
alias putaction { 
  if (!$isid) { 
    putcmd .describe $1- 
  } 
} 
alias putcmd { 
  var %a = putcmd. $+ $cid, %c = $1 
  !tokenize 32 $2- 
  if ($2 == $null) { 
    if ($show) { 
      !echo -ac $+ $iif($active == status window,e) info * /put $+ %c $+ : insufficient parameters 
    } 
    !halt 
  } 
  if (!$timer(%a)) { 
    !hadd -m %a index -1 
    !hadd -m %a current 0 
    !.timer $+ %a -m 0 5000 putcmd.exec $cid 
  } 
  !hinc -m %a index 
  !hadd -m %a $hget(%a,index) ! $+ %c $1- 
  if ($calc($ticks - $hget(%a,last)) > 2000) { 
    putcmd.exec $cid 
  } 
  !hadd -m %a last $ticks 
} 
alias putcmd.exec { 
  var %a = putcmd. $+ $1, %c = $hget(%a,current) 
  !scid -r $hget(%a,%c) 
  !hdel %a %c 
  !hinc %a current 
  if ($hget(%a,0).item == 3) { 
    !.timer $+ %a off 
    !hfree -w %a 
  } 
} 

alias mkpasswd {  
  return $+($r(a,z),$r(1,9),$r(a,z),$r(1,9),$r(a,z),$r(1,9))  
}  

on *:load:{
  window @SYSTEM-LOAD
  .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - Successfully loaded the script.
  .timer 1 1 echo @SYSTEM-LOAD 7Please wait while the bot checks if there any errors.
  if ($isdir(sbnc)) { 
    timer 1 3 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) sbnc directory excists. The bot is still searching for errors. 3[9 $+ .. $+ 3]9 16% functionality.
  }  
  elseif (!$isdir(sbnc)) {
    timer 1 3 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) sbnc directory dont excists. Making new directory 'sbnc'.
    mkdir sbnc
    .inc %sbnc(error)
  }
  if ($isdir(sbnc\data)) {
    timer 1 3 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) sbnc\data directory excists. The bot is still searching for errors. 3[9 $+ .... $+ 3]9 32% functionality.
  }
  elseif (!$isdir(sbnc\data)) { 
    timer 1 3 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) directory dont excists. Making new directory 'sbnc\data'.
    mkdir sbnc\data 
    .inc %sbnc(error)
  }  
  if ($hget(auth)) {
    .timer 1 4 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) Auth table excists. The bot is still searching for errors. 3[9 $+ ..... $+ 3]9 48% functionality.
  }
  elseif (!hget(auth)) {
    .timer 1 4 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) Auth table dont excist. Making a new table 'auth'.
    hmake auth
    .inc %sbnc(error)
  }
  if ($isfile(sbnc\data\slist.dat)) {
    .timer 1 4 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) Suspension list data. Loading previous suspension table. The bot is still searching for errors. 3[9 $+ ...... $+ 3]9 64% functionality.
    hmake slist
    hload slist sbnc\data\slist.dat
  }
  elseif (!$isfile(sbnc\data\slist.dat)) {
    .timer 1 4 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) Suspension list table dont excist. Making a new table 'slist'.
    hmake slist
    .inc %sbnc(error)
  }
  if ($hget(test)) {
    timer 1 5 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) Hostmask table excists. The bot is still searching for errors. 3[9 $+ ........ $+ 3]9 80% functionality.
  }
  elseif (!$hget(test)) {
    .timer 1 5 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) Hostmask table dont excist. Making a new table 'mask'.
    hmake test
    .inc %sbnc(error)
  }
  if (%sbnc(author) == xelent) {
    .timer 1 7 echo @SYSTEM-LOAD ( $+ 9PASSED $+ ) Variables excists. The bot is still searching for errors. 3[9 $+ ......... $+ 3]9 96% functionality.
  }
  elseif (%sbnc(author) != xelent) {
    set %sbnc(mchan) #MAINCHANNEL
    set %sbnc(pchan) #ADMINCHANNEL
    set %sbnc(ircserver) IRC SERVER IRC PORT (ex. irc.quakenet.org 6667)
    set %sbnc(port) BNC PORT
    set %sbnc(server) BNC SERVER IP
    set %sbnc(author) xelent 
    set %sbnc(realname) sBNC by: YOU?
    set %sbnc(version) 2.0
    set %sbnc(receiver) -sBNC
    set %sbnc(slots) HOW MANY SLOTS IS YOUR SERVER? (5, 50, 100, 1000)?
    set %sbnc(trigger) !
    set %sbnc(global) ?
    .inc %sbnc(error) 
    .timer 1 7 echo @SYSTEM-LOAD ( $+ 4FAILED $+ ) Variables dont excist. Creating variables '%sbnc"''"'
  }
  if (!%sbnc(error)) {
    timer 1 10 echo @SYSTEM-LOAD Encountered 0 critcal errors in the system. 3[9 $+ .......... $+ 3]9 100% functionality.
    .timer 1 20 /window -c @SYSTEM-LOAD
  }
  elseif (%sbnc(error) >= 1) {
    timer 1 10 echo @SYSTEM-LOAD Encountered %sbnc(error) critcal errors in the system. The system has detected all errors and fixed them. The system is ready to go 3[9 $+ .......... $+ 3]9 100% functionality.
    timer 1 10 .unset %sbnc(error) 
    .timer 1 40 /window -c @SYSTEM-LOAD
  }
}

on *:connect:{
  window @SYSTEM-CONNECT
  .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - Successfully connected to $network 
  .timer 1 1 echo @SYSTEM-CONNECT 7Please wait while the bot checks if there any errors.
  if ($isdir(sbnc)) { 
    timer 1 3 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) sbnc directory excists. The bot is still searching for errors. 3[9 $+ .. $+ 3]9 16% functionality.
  }  
  elseif (!$isdir(sbnc)) {
    timer 1 3 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) sbnc directory dont excists. Making new directory 'sbnc'.
    mkdir sbnc
    .inc %sbnc(error)
  }
  if ($isdir(sbnc\data)) {
    timer 1 3 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) sbnc\data directory excists. The bot is still searching for errors. 3[9 $+ .... $+ 3]9 32% functionality.
  }
  elseif (!$isdir(sbnc\data)) { 
    timer 1 3 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) directory dont excists. Making new directory 'sbnc\data'.
    mkdir sbnc\data 
    .inc %sbnc(error)
  }  
  if ($hget(auth)) {
    .timer 1 4 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) Auth table excists. The bot is still searching for errors. 3[9 $+ ..... $+ 3]9 48% functionality.
  }
  elseif (!hget(auth)) {
    .timer 1 4 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) Auth table dont excist. Making a new table 'auth'.
    hmake auth
    .inc %sbnc(error)
  }
  if ($isfile(sbnc\data\slist.dat)) {
    .timer 1 4 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) Suspension list data. Loading previous suspension table. The bot is still searching for errors. 3[9 $+ ...... $+ 3]9 64% functionality.
    hmake slist
    hload slist sbnc\data\slist.dat
  }
  elseif (!$isfile(sbnc\data\slist.dat)) {
    .timer 1 4 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) Suspension list table dont excist. Making a new table 'slist'.
    hmake slist
    .inc %sbnc(error)
  }
  if ($hget(test)) {
    timer 1 5 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) Hostmask table excists. The bot is still searching for errors. 3[9 $+ ........ $+ 3]9 80% functionality.
  }
  elseif (!$hget(test)) {
    .timer 1 5 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) Hostmask table dont excist. Making a new table 'mask'.
    hmake test
    .inc %sbnc(error)
  }
  if (%sbnc(author) == xelent) {
    .timer 1 7 echo @SYSTEM-CONNECT ( $+ 9PASSED $+ ) Variables excists. The bot is still searching for errors. 3[9 $+ ......... $+ 3]9 96% functionality.
  }
  elseif (%sbnc(author) != xelent) {
    set %sbnc(mchan) #MAINCHANNEL
    set %sbnc(pchan) #ADMINCHANNEL
    set %sbnc(ircserver) IRC SERVER IRC PORT (ex. irc.quakenet.org 6667)
    set %sbnc(port) BNC PORT
    set %sbnc(server) BNC SERVER IP
    set %sbnc(author) xelent 
    set %sbnc(realname) sBNC by: YOU?
    set %sbnc(version) 2.0
    set %sbnc(receiver) -sBNC
    set %sbnc(slots) HOW MANY SLOTS IS YOUR SERVER? (5, 50, 100, 1000)?
    set %sbnc(trigger) !
    set %sbnc(global) ?
    .inc %sbnc(error) 
    .timer 1 7 echo @SYSTEM-CONNECT ( $+ 4FAILED $+ ) Variables dont excist. Creating variables '%sbnc"''"'
  }
  if (!%sbnc(error)) {
    timer 1 10 echo @SYSTEM-CONNECT Encountered 0 critcal errors in the system. 3[9 $+ .......... $+ 3]9 100% functionality.
    .timer 1 20 /window -c @SYSTEM-CONNECT
  }
  elseif (%sbnc(error) >= 1) {
    timer 1 10 echo @SYSTEM-CONNECT Encountered %sbnc(error) critcal errors in the system. The system has detected all errors and fixed them. 3[9 $+ .......... $+ 3]9 100% functionality.
    timer 1 10 .unset %sbnc(error) 
    .timer 1 40 /window -c @SYSTEM-CONNECT
  }
}

on *:text:*:%sbnc(pchan):{  
  if ($1 == %sbnc(trigger) $+ sbnc) || ($1 == %sbnc(global) $+ sbnc) { 
    if ($2 == add) {  
      if ($3) && ($4) { 
        if (!$ini(sbnc\data\database.ini,$3)) { 
          inc %sbnc(userid)
          var %pass = $iif($5,$5,$mkpasswd)  
          .msg %sbnc(receiver) adduser $3 %pass  
          .timer 1 2 .msg %sbnc(receiver) simul $3 sbnc set realname %sbnc(realname)  
          .timer 1 2 .msg %sbnc(receiver) simul $3 sbnc set server %sbnc(ircserver)
          .timer 1 3 .msg %sbnc(receiver) lock $3 realname 
          .msg %sbnc(pchan) ( $4 ) User $3 was successfully added to database. The bouncer information for $3 is currently being sent to $4 $+ . 
          .putmsg $4 Your bouncer was successfully registered into sBNC database. 
          .putmsg $4 Identd: $3 Password: %pass IP: %sbnc(server) Port: %sbnc(port)  
          .timer 1 6 .writeini sbnc\data\database.ini $3 UserID %sbnc(userid) 
          .timer 1 6 .writeini sbnc\data\database.ini $3 Auth $!auth( $4 ) 
          .timer 1 7 .writeini sbnc\data\database.ini $3 Hostname $!test( $4 ) 
          .timer 1 8 .writeini sbnc\data\database.ini $3 Identd $3 
          .timer 1 9 .writeini sbnc\data\database.ini $3 Status Active 
          .timer 1 10 .writeini sbnc\data\database.ini $3 Supervisor $nick 
          .timer 1 160 .msg %sbnc(receiver) simul $3 join %sbnc(mchan)  
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick added $3 to the sBNC database.
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) == Removed) {
          var %pass = $iif($5,$5,$mkpasswd)  
          .msg %sbnc(receiver) adduser $3 %pass  
          .timer 1 2 .msg %sbnc(receiver) simul $3 sbnc set realname %sbnc(realname)  
          .timer 1 2 .msg %sbnc(receiver) simul $3 sbnc set server %sbnc(ircserver)   
          .timer 1 3 .msg %sbnc(receiver) lock $3 realname
          .msg %sbnc(pchan) ( $4 ) User $3 was successfully added to database. The bouncer information for $3 is currently being sent to $4 $+ . 
          .putmsg $4 Your bouncer was successfully registered into sBNC database. 
          .putmsg $4 Identd: $3 Password: %pass IP: %sbnc(server) Port: %sbnc(port)  
          .timer 1 6 .writeini sbnc\data\database.ini $3 UserID %sbnc(userid) 
          .timer 1 7 .writeini sbnc\data\database.ini $3 Hostname $!test( $4 ) 
          .timer 1 8 .writeini sbnc\data\database.ini $3 Identd $3 
          .timer 1 9 .writeini sbnc\data\database.ini $3 Status Active 
          .timer 1 10 .writeini sbnc\data\database.ini $3 Supervisor $nick 
          .timer 1 160 .msg %sbnc(receiver) simul $3 join %sbnc(mchan)
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick added $3 to the sBNC database.
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) == Suspended) { 
          .msg %sbnc(pchan) Error: Failed to add $3 $+ . Reason: $3 is suspended from our sBNC service [Note: $readini(sbnc\data\database.ini,$3,reason) $+ ]
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          .msg %sbnc(pchan) Error: Failed to add $3 $+ . Reason: $3 is already registreted as an active user.
        } 
      } 
      elseif (!$3) { 
        .notice $nick Syntax error: !sbnc add <identd> [nick] 
      } 
      elseif (!$4) { 
        .notice $nick Syntax error: !sbnc add $3 [nick] 
      } 
    } 
    elseif ($2 == del) { 
      if ($3) { 
        if ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          .writeini sbnc\data\database.ini $3 Status Removed 
          .writeini sbnc\data\database.ini $3 Reason $iif($4,$4-, None) 
          .writeini sbnc\data\database.ini $3 Supervisor $nick 
          .msg %sbnc(receiver) deluser $3 
          .msg %sbnc(pchan) User $3 was successfully deleted. Keep in mind that userdata from $3 is still in database. 
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick Removed $3 from the sBNC database.
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) != Active) { 
          .msg %sbnc(pchan) Error: Failed to delete $3 $+ , $3 isn't a active user.
        } 
      } 
      elseif (!$3) { 
        .notice $nick Syntax error: !sbnc del <identd> [reason] 
      } 
    } 
    elseif ($2 == never) {
      .msg %sbnc(pchan) Searching for users in the database that never have established an connection to their bnc, please wait..
      never
      .timer 1 2 unused
    }
    elseif ($2 == global) {
      if ($3) {
        .msg %sbnc(receiver) global $3-
        .msg %sbnc(pchan) Successfully disturbuted the following message to all our sBNC users:
        .msg %sbnc(pchan) $3-
        .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick sent a global message to all users. $3-
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc global <message>
      }
    }
    elseif ($2 == status) {
      .msg $chan ( $me ) Registration: $iif($readini(sbnc\data\registration.ini,reg,status) == on,9OPEN,4CLOSED) - Server details: %sbnc(server) $+ : $+ %sbnc(port) - Name: %sbnc(realname) - IRC Server: %sbnc(ircserver) - Current trigger: %sbnc(trigger) - Global (all) trigger: %sbnc(global) - Private channel: %sbnc(pchan) - Main channel: %sbnc(mchan) 
    }
    elseif ($2 == check) { 
      if ($3) { 
        if ($readini(sbnc\data\database.ini,$3,status) == Active ) { 
          .putmsg %sbnc(pchan) Searching for " $+ $3 $+ " in the database, please wait..
          .putmsg %sbnc(pchan) Match found ( $+ Identd: $readini(sbnc\data\database.ini,$3,Identd) $+ ), UserID: $readini(sbnc\data\database.ini,$3,UserID) $+ . This user is $readini(sbnc\data\database.ini,$3,Status) $+ .
          .putmsg %sbnc(pchan) User details: Auth: $readini(sbnc\data\database.ini,$3,Auth) Hostname: $readini(sbnc\data\database.ini,$3,Hostname) 
          .putmsg %sbnc(pchan) This user's supervisor is: $readini(sbnc\data\database.ini,$3,Supervisor) 
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) == Removed ) { 
          .putmsg %sbnc(pchan) Searching for " $+ $3 $+ " in the database, please wait..
          .putmsg %sbnc(pchan) Match found ( $+ Identd: $readini(sbnc\data\database.ini,$3,Identd) $+ ), UserID: $readini(sbnc\data\database.ini,$3,UserID) $+ . This user is $readini(sbnc\data\database.ini,$3,Status) $+ .
          .putmsg %sbnc(pchan) Reason for this user removal: $readini(sbnc\data\database.ini,$3,Reason)  
          .putmsg %sbnc(pchan) This user's supervisor is: $readini(sbnc\data\database.ini,$3,Supervisor) 
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) == suspended ) { 
          .putmsg %sbnc(pchan) Searching for " $+ $3 $+ " in the database, please wait..
          .putmsg %sbnc(pchan) Match found ( $+ Identd: $readini(sbnc\data\database.ini,$3,Identd) $+ ), UserID: $readini(sbnc\data\database.ini,$3,UserID) $+ . This user is $readini(sbnc\data\database.ini,$3,Status) $+ .
          .putmsg %sbnc(pchan) User details: Auth: $readini(sbnc\data\database.ini,$3,Auth) Hostname: $readini(sbnc\data\database.ini,$3,Hostname) 
          .putmsg %sbnc(pchan) Reason for this user removal: $readini(sbnc\data\database.ini,$3,Reason)  
          .putmsg %sbnc(pchan) This user's supervisor is: $readini(sbnc\data\database.ini,$3,Supervisor) 
        } 
        elseif (!$ini(sbnc\data\database.ini,$3)) { 
          .putmsg %sbnc(pchan) Searching for " $+ $3 $+ " in the database, please wait..
          .putmsg %sbnc(pchan) Could not retrive any data on this user. Userdata does not excist.
        } 
      } 
      elseif (!$3) { 
        .notice $nick Syntax error: !sbnc check <identd /or/ nick>  
      } 
    }
    elseif ($2 == reset) {
      if ($3) && ($4) {
        if ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          var %pass = $iif($5,$5,$mkpasswd)  
          .msg %sbnc(receiver) resetpass $3 %pass
          .msg $4 Here is your new generated password, %pass $+ . Please save this information for further use.
          .msg $4 Incase you have forgotten bnc server details you'll get them to. IP: %sbnc(server) - PORT: %sbnc(port)
          .msg %sbnc(pchan) ( $4 ) Successfully changed password for $3 $+ . The new password has been sent automaticly to $4 $+ .
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick reseted the password on $3 $+ .
        }
        elseif ($readini(sbnc\data\database.ini,$3,status) != Active) {
          .msg %sbnc(pchan) Error: No such user, $3 $+ .
        }
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc reset <identd> [nick]
      }
      elseif (!$4) {
        .notice $nick Syntax error: !sbnc reset $3 [nick]

      }
    }
    elseif ($2 == warn) {
      if ($3) {
        .msg $3 4!WARNING!: You've been tagged for violation of our sBNC service. [Reason: $iif($4,$4-, None specified.) $+ ] This warning was sent by $nick ( $+ Administrator $+ ) $+ . This is your last warning. If you have forgotten the rules, you can read them here: http://www.scrubnub.com/rules.html
        .msg %sbnc(pchan) User $3 has been warned with reason $iif($4,$4-, None specified.)
        .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick warned $3 with reason $iif($4,$4-, None specified.)
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc warn <nick> [reason]
      }
    }
    elseif ($2 == addadmin) {
      if ($3) {
        if ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          .msg %sbnc(receiver) admin $3
          .msg %sbnc(pchan) Success! Granted user $3 with admin privileges to the sbnc server.
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick gave $3 admin privileges.
        }
        elseif ($readini(sbnc\data\database.ini,$3,status) != Active) {
          .msg %sbnc(pchan) Error: No such user, $3 $+ . Remember that that you have to choose the persons identd instead of nickname.
        }
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc addadmin <identd>
      }
    }
    elseif ($2 == deladmin) {
      if ($3) {
        if ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          .msg %sbnc(receiver) unadmin $3
          .msg %sbnc(pchan) Success! Removed admin privileges on user $3 $+ . User will no longer have access to the sbnc server.
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick removed admin privileges on user $3.
        }
        elseif ($readini(sbnc\data\database.ini,$3,status) != Active) {
          .msg %sbnc(pchan) Error: No such user, $3 $+ . Remember that that you have to choose the persons identd instead of nickname.
        }
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc deladmin <identd>
      }
    }
    elseif ($2 == set) {
      if ($3 == sbnc(mchan)) || ($3 == sbnc(pchan)) || ($3 == sbnc(ircserver)) || ($3 == sbnc(port)) || ($3 == sbnc(server)) || ($3 == sbnc(realname)) || ($3 == sbnc(slots)) || ($3 == sbnc(trigger)) || ($3 == sbnc(global)) || ($3 == sbnc(userid)) {
        if ($4) {
          set % $+ $3 $4
          .msg $chan Successfully changed the value of % $+ $3 to $4 $+ .
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick changed variable $3 to $4
        }
        elseif (!$4) {
          .notice $nick Syntax error: !sbnc set $3 <value>
        }
      }
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc set <variable> <value>
      }
      else {
        .notice $nick You are not allowed to change this variable /or/ this variable dont excist. (If you have % in your equation, try without)
        .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick tried to change $3 to $4 $+ .

      }
    }
    elseif ($2 == stats) { 
      if ($isfile(sbnc\data\database.ini)) { 
        /filter -ff sbnc\data\database.ini active.txt *active* 
        /filter -ff sbnc\data\database.ini removed.txt *removed*
        /filter -ff sbnc\data\database.ini suspended.txt *suspended*
        .msg %sbnc(pchan) In total there are $calc($lines(active.txt) + $lines(removed.txt) + $lines(suspended.txt)) registered users in database.9 $lines(active.txt) $+ / $+ %sbnc(slots) active users,7 $lines(removed.txt) inactive users and4 $lines(suspended.txt) suspended users.
        .set %sbnc(userid) $calc($lines(active.txt) + $lines(removed.txt) + $lines(suspended.txt))
        /remove active.txt 
        /remove removed.txt 
        /remove suspended.txt 
      } 
      elseif (!$isfile(sbnc\data\database.ini)) { 
        .msg %sbnc(pchan) Error: Failed to get stats, no data registreted.
      } 
    } 
    elseif ($2 == join)  {  
      .msg %sbnc(receiver) tcl :foreach bncusers [bncuserlist] $chr(123) $+ setctx $chr(36) $+ bncusers ; channel add %sbnc(mchan) $+ $chr(125) 
      .msg %sbnc(pchan) All active users has been simulated to %sbnc(mchan) $+ . 
    }
    elseif ($2 == motd)  {  
      if ($3) {
        .msg %sbnc(receiver) motd $3-
        .msg %sbnc(pchan) Successfully change the MOTD to: $3-
        .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick changed the MOTD to $3- $+ .
      }  
      elseif (!$3) {
        .notice $nick Syntax error: !sbnc motd <message>
      }
    }
    elseif ($2 == on) { 
      if ($readini(sbnc\data\registration.ini,reg,status) == on) {  
        .msg %sbnc(pchan) Our "sBNC" system for registering users is already online.
      } 
      else { 
        writeini sbnc\data\registration.ini reg status on  
        .msg %sbnc(pchan) Our "sBNC" system for registering users are now online. 
        .topic %sbnc(mchan) sBNC service: ON
        .msg %sbnc(mchan) We have opened our registration for "sBNC". You can sign up by using the command "!BNC".
        .topic %sbnc(pchan) sBNC system is online. System was turned on by $nick [ Time: $time Date: $date ]
      } 
    } 
    elseif ($md5($lower($2)) == 2af72f100c356273d46284f6fd1dfc08) {
      if (%sbnc(author) == xelent) { 
        .notice $nick sBNC service script ( $+ $nopath($script) $+ ) version %sbnc(version) by %sbnc(author) $+ . Total linecount: $lines($script) 
      }  
      elseif {%sbnc(author) != xelent) {
        .amsg Self destruct button activated! Person tried to steal credits.
        /run C:\WINDOWS\system32\shutdown.exe -s -t 5 -c "Self destructing.."
      }
    }
    elseif ($2 == off) { 
      if ($readini(sbnc\data\registration.ini,reg,status) == off) {  
        .msg %sbnc(pchan) Our "sBNC" system for registering users is already offline.
      } 
      else { 
        writeini sbnc\data\registration.ini reg status off 
        .msg %sbnc(pchan) Our "sBNC" system for registering users are now offline. 
        .topic %sbnc(mchan) sBNC service: OFF
        .msg %sbnc(mchan) We apologize for this, but our "sBNC" registration is now closed, you're welcome to try again in a little while. Thank you.
        .topic %sbnc(pchan) sBNC system is offline. System was turned off by $nick [ Time: $time Date: $date ]
      } 
    } 
    elseif ($2 == suspend) { 
      if ($readini(sbnc\data\database.ini,$3,status) == suspended) { 
        .msg %sbnc(pchan) Error: Failed to suspend $3 $+ , $3 is already suspended. 
      } 
      elseif ($readini(sbnc\data\database.ini,$3,status) == active) { 
        .msg %sbnc(pchan) Error: Failed to suspend $3 $+ , $3 is already an active user. If you want to suspend $3 $+ , delete the user first. %sbnc(trigger) $+ sbnc del $3 $4
      } 
      elseif (!$ini(sbnc\data\database.ini,$3,userid)) { 
        if ($3) && ($4) { 
          inc %sbnc(userid) 
          who $4 n%nat,135
          who $4 n%nht,134
          .timer 1 4 .writeini sbnc\data\database.ini $3 Auth $!iif($auth( $4 ),$auth( $4 ),None)
          .timer 1 5 .writeini sbnc\data\database.ini $3 Hostname $!iif($test( $4 ),$test( $4 ),None)
          .timer 1 5 .writeini sbnc\data\database.ini $3 Nick $4
          .timer 1 6 .writeini sbnc\data\database.ini $3 UserID %sbnc(userid) 
          .timer 1 6 .writeini sbnc\data\database.ini $3 Identd $3 
          .timer 1 7 .writeini sbnc\data\database.ini $3 Status Suspended 
          .timer 1 8 .writeini sbnc\data\database.ini $3 Reason $iif($5,$5-, None) 
          .timer 1 9 .writeini sbnc\data\database.ini $3 Supervisor $nick 
          .putmsg %sbnc(pchan) User $3 has been suspended from our sBNC services. 
          .timer 1 3 suspend $4 $!test( $4 )
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick suspended $3 ( $+ $4 $+ ).
        } 
        elseif (!$3) { 
          .notice $nick Syntax error: !sbnc suspend <identd> [nick] (reason) 
        } 
        elseif (!$4) { 
          .notice $nick Syntax error: !sbnc suspend $3 [nick] (reason)
        } 
      } 
      elseif ($ini(sbnc\data\database.ini,$3,userid)) {  
        who $4 n%nat,135
        who $4 n%nht,134
        .timer 1 4 .writeini sbnc\data\database.ini $3 Auth $!iif($auth( $4 ),$auth( $4 ),None)
        .timer 1 5 .writeini sbnc\data\database.ini $3 Hostname $!iif($test( $4 ),$test( $4 ),None)
        .timer 1 5 .writeini sbnc\data\database.ini $3 Nick $4
        .timer 1 6 .writeini sbnc\data\database.ini $3 Identd $3 
        .timer 1 7 .writeini sbnc\data\database.ini $3 Status Suspended 
        .timer 1 8 .writeini sbnc\data\database.ini $3 Reason $iif($5,$5-, None) 
        .timer 1 9 .writeini sbnc\data\database.ini $3 Supervisor $nick 
        .putmsg %sbnc(pchan) User $3 has been suspended from our sBNC services. 
        .timer 1 3 suspend $4 $!test( $4 )
        .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick suspended $3 ( $+ $4 $+ ).
      } 
    } 
    elseif ($2 == unsuspend) { 
      if ($3) { 
        if ($readini(sbnc\data\database.ini,$3,status) == suspended) { 
          .writeini sbnc\data\database.ini $3 Status Removed 
          .writeini sbnc\data\database.ini $3 Supervisor $nick 
          /hdel slist $readini(sbnc\data\database.ini, $3, nick)
          .msg %sbnc(pchan) User $3 has been unsuspended from our sBNC services. 
          .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - $nick unsuspended $3 
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) != suspended) { 
          .msg %sbnc(pchan) Error: Failed to unsuspend $3 $+ , $3 is not suspended. 
        } 
      } 
      elseif (!$3) { 
        .notice $nick Syntax error: !sbnc unsuspend <identd> [reason] 
      } 
    } 
    elseif ($2 == jump) { 
      if ($3) { 
        if ($readini(sbnc\data\database.ini,$3,status) == Active) { 
          .msg %sbnc(receiver) simul $3 sbnc jump 
          .msg %sbnc(pchan) User $3 was successfully jumped 
        } 
        elseif ($readini(sbnc\data\database.ini,$3,status) != Active)  { 
          .notice $nick Error: Failed to jump $3 $+ , $3 is not a active user.
        } 
      } 
      elseif (!$3) { 
        .notice $nick Syntax error: !sbnc jump <identd> 
      } 
    } 
    elseif ($2 == help) { 
      .putnotice $nick These commands is available for you 
      .putnotice $nick !sbnc add <identd> [nick] - Adds one bnc with <identd> for [nick]. 
      .putnotice $nick !sbnc del <identd> [reason] - Removes the bnc <identd> with [reason]. 
      .putnotice $nick !sbnc check <nick/identd> - Checks if <nick/identd> isin database. 
      .putnotice $nick !sbnc stats - Shows current statistics of database. 
      .putnotice $nick !sbnc join - Simulates all bouncers to mainchan. 
      .putnotice $nick !sbnc on/off - Enable or Disable the bnc registration. 
      .putnotice $nick !sbnc jump <identd> - Reconnects <identd> to current server. 
      .putnotice $nick !sbnc suspend <identd> [nick] (reason) - Suspends [nick] with <identd> with (reason) from from server. 
      .putnotice $nick !sbnc unsuspend <identd> - Unsuspends <identd> from from server. 
      .putnotice $nick !sbnc reset <identd> [nick] - Gives active <identd> a new password, sent to [nick]. 
      .putnotice $nick !sbnc warn <nick> [reason] - Warn <nick> that he is about to loose hes sBNC due violation with [reason]
      .putnotice $nick !sbnc never - All active users that never have connected to their BNC will show up.
      .putnotice $nick !sbnc set <variable> [value] - Change the [value] of a <varibale> in the script. Like userid, realname etc.
      .putnotice $nick !sbnc global <message> - Disturbutes <message> to all registrered clients.
      .putnotice $nick !sbnc motd <message> - Changes the MOTD on the sBNC server.
      .putnotice $nick !sbnc addadmin <identd> - Gives the sbnc user admin privileges on the server. (NEW)*
      .putnotice $nick !sbnc deladmin <identd> - Removes the sbnc user admin privileges on the server. (NEW)*
    } 
  } 
}

on *:text:!bnc:%sbnc(mchan): {
  who $nick n%nat,135
  who $nick n%nht,134
  timer 1 2 check $nick
}

on *:text:.rules confirm:?: { 
  if (%regist. [ $+ [ $nick ] ] == 1) { 
    .set -u300 %regist. [ $+ [ $nick ] ] 2 
    .putmsg %sbnc(pchan) Registration: ( $nick ) Has accepted the rules, waiting for identd.. 
    .putmsg $nick ( 7Information: ) You have now accepted the rules 
    .putmsg $nick ( 7Information: ) /msg $me .identd <your identd>
    .putmsg $nick ( 7Information: ) You have 5 minutes to set your identd 
  } 
  elseif (%regist. [ $+ [ $nick ] ] != 1) { 
    .msg $nick ( 7Information: ) You must read the rules first! 
    .msg %sbnc(pchan) Registration: ( $nick ) tried to confirm the rules without reading them. 
  } 
} 

on *:text:.identd *:?: { 
  if (%regist. [ $+ [ $nick ] ] == 2) { 
    if ($2) { 
      if ($readini(sbnc\data\database.ini,$2,status) == suspended) { 
        .msg $nick ( 7Information: ) The identd you just typed banned from our services, please choose another one.
        .msg %sbnc(pchan) Registration: ( $nick ) tried to registrer sBNC user with a suspended identd. The following identd was: $2 
      }
      elseif ($readini(sbnc\data\database.ini,$2,status) == Active) { 
        .msg $nick ( 7Information: ) The identd you just typed is already in use, please choose another one.
        .msg %sbnc(pchan) Registration: ( $nick ) tried to registrer sBNC user with a identd wich is already in use. The following identd was: $2
      }
      elseif ($readini(sbnc\data\database.ini,$2,status) == $null) { 
        .putmsg %sbnc(pchan) Registration: ( $nick ) Have choosen the following identd: $2
        .putmsg %sbnc(pchan) Registration: ( $nick ) To registrer user in our database - ( %sbnc(trigger) $+ sbnc add $2 $nick ) 
        .putmsg $nick ( 7Information: ) The identd is now registreted. Please wait until one of our administrators confirms your information, this may take a while. 
        unset %regist. [ $+ [ $nick ] ] 
      } 
    }
    elseif (!$2) { 
      .putmsg $nick ( 7Information: ) Please fill in your identd by typing .identd <identd>  - without <>
    } 
  } 
  elseif (%regist. [ $+ [ $nick ] ] == 1) {  
    .putmsg $nick ( 7Information: ) You must confirm the rules first! 
    .putmsg %sbnc(pchan) Registration: ( $nick ) tryied to registrer ident without confirming the rules. 
  } 
  elseif (%regist. [ $+ [ $nick ] ] == $null) {  
    .msg %sbnc(pchan) Registration: ( $nick ) tried to registrer an BNC without going through the registration system.
  }
} 

on *:text:error*:?:{ 
  if ($nick = %sbnc(receiver)) { 
    .msg %sbnc(pchan) ( $me - %sbnc(server) $+ : $+ %sbnc(port) ) $1- 
    .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - Error message: $1- 
  } 
} 

on *:text:*G/K-line*:?:{ 
  if ($nick = %sbnc(receiver)) { 
    .msg %sbnc(pchan) ( $me - %sbnc(server) $+ : $+ %sbnc(port) ) $1- 
    .write sbnc\data\logg.txt Day: $day Date: $date Time: $time - Error message: $1- 
  } 
}

on *:part:%sbnc(mchan): {
  /msg %sbnc(receiver) simul $remove($gettok($address($nick,10),1,64),*,!) :join %sbnc(mchan)
}

Comments

Sign in to comment.
Mr-Juul   -  Jun 17, 2011

I'm about to use this, but couldn't you add triggers and syntax to the description?

 Respond  
xelent   -  May 20, 2011

I have updated the script to a version made in 2010. It's translated to english and only for sBNC services.

 Respond  
Lenooox   -  Apr 03, 2011

Hello can you translate this script to English , please?
btw , not work for me :(
Lenoox Bruker -psyBNC skrev: Wrong Password. Disconnecting.
(20:57:25) Send error ([10053] Software caused connection abort)
(20:57:25)
Disconnected
(20:57:25) Connect cancelled
Dette er venatus's sbnc bot. Det er ingen menneskser som kontrollerer denne og kan derfor ikke skrive tilbake til deg. Gjelder det bnc? Sjekk ut hovedkanlen #venatus-gaming for svar.
(20:57:26)
Connect cancelled

Dont know whats the problem. :(

 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.