This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

sBNC Script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
G
GeeX
Voice
Posts: 29
Joined: Mon Sep 19, 2005 4:29 am

sBNC Script

Post by GeeX »

Code: Select all

#  __                __      __    
# /\ \              /\ \  __/\ \   
# \ \ \         __  \ \ \/\ \ \ \  
#  \ \ \  __  /'__`\ \ \ \ \ \ \ \ 
#   \ \ \_\ \/\ \_\ \_\ \ \_/ \_\ \
#    \ \____/\ \__/ \_\\ `\___ ___/
#     \/___/  \/__/\/_/ '\/__//__/ 
#
# sBNC Script by LaW.
#
# | author:     LaW                             
# | version:    1.6                            
# | web:        www.myGeeX.de                   
# | irc:        #GeeX at Quakenet               
# | contact:    www.myGeeX.de/?page_id=17         
#                                                  
# +-------------+
# | r e a d m e |
# +-------------+
# 
# | upload this script via ftp and write:
# |     - 'source url/to/script/sbnc.tcl'
# | into your eggdrop configuration.
# | After you have done this rehash or restart your eggdrop.
# | Type !sbnc help to see the help.
#
# +-------------------+
# | c h a n g e l o g |
# +-------------------+
#
# |     - (03.05.06) v1.0:   release
# |     - (14.05.06) v1.1:   added list command
# |     - (26.05.06) v1.2:   added modex command
# |     - (05.06.06) v1.3:   code review
# |     - (12.06.06) v1.4:   added add command
# |     - (21.06.06) v1.5:   more advanced code
# |     - (18.07.06) v1.6:   full sbnc management added
#
# +-------------------+
# | c o p y r i g h t |
# +-------------------+
#
# Copyright (C) 2006  Laurids 'GeeX' W.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Don't change anything.
# Report bugs to #GeeX at Quakenet.


#  Manages your sbnc over irc

  #  configuration

    #  variables

        set sbnc(trigger)   "\!"
        set sbnc(version)   "1.6"
        set sbnc(author)    "Laurids 'GeeX' W. (#GeeX at Quakenet)"
        set sbnc(chan)      "#GeeX"
        set sbnc(ident)     "Ch"
        set sbnc(ircserver) "irc.quakenet.org 6667"
        set sbnc(server)    "myGeeX.de"
        set sbnc(port)      "1337"
        set sbnc(realname)  "powered by #GeeX"
        set sbnc(iface)     "http://sbnc.myGeeX.de"

    #  bindings

        bind PUB  n|- $sbnc(trigger)sbnc sbnc:iface
        bind NOTC  |  *                  sbnc:notice

    #  copyright

        putlog "sBNC Script version $sbnc(version) scripted by $sbnc(author)"

    #  source (again DO NOT change anything if you are not 100% sure)

        proc sbnc:iface { nick host hand chan arg } {
            global sbnc
            switch -exact -- [string tolower [lindex [split $arg] 0]] {
                "add" {
                    set ident [lindex [split $arg] 1]
                    set password [expr {int(rand()*1000000) + 1}]
                    set realname [lindex [split $arg] 2]
                    if {$realname == ""} {
                        set realname $sbnc(realname)
                    }
                    putquick "SBNC ADDUSER $ident $password"
                    putquick "SBNC SIMUL $ident SBNC SET REALNAME $realname"
                    putquick "SBNC SIMUL $ident SBNC SET SERVER $sbnc(ircserver)"
                    utimer 60 [list putquick "SBNC SIMUL $ident JOIN $sbnc(chan)"]
                    putquick "NOTICE $nick :Done. New bnc added."
                    putquick "NOTICE $nick :Server: $sbnc(server), Port: $sbnc(port), Ident: $ident, Password: $password, Iface: $sbnc(iface)"
                }
                "del" {
                    set ident [lindex [split $arg] 1]
                    putquick "SBNC DELUSER $ident"
                    putquick "NOTICE $nick :Done. User ($ident) deleted."
                }
                "password" {
                    set ident [lindex [split $arg] 1]
                    set password [expr {int(rand()*1000000) + 1}]
                    putquick "SBNC RESETPASS $ident $password"
                    putquick "NOTICE $nick :Done. New password for user ($ident) created."
                    putquick "NOTICE $nick :Password: $password"
                }
                "admin" {
                    set ident [lindex [split $arg] 1]
                    if {$ident == "$sbnc(ident)"} {
                        putquick "NOTICE $nick :Error. This ident is already an admin."
                        return
                    } else {
                        putquick "SBNC ADMIN $ident"
                        putquick "NOTICE $nick :Done. User ($ident) has now admin rights."
                    }
                }
                "unadmin" {
                    set ident [lindex [split $arg] 1]
                    if {$ident == "$sbnc(ident)"} {
                        putquick "NOTICE $nick :Error. This ident needs admin rights."
                        return
                    } else {
                        putquick "SBNC UNADMIN $ident"
                        putquick "NOTICE $nick :Done. Admin rights for user ($ident) deleted."
                    }
                }
                "global" {
					set arg [lindex [split $arg] 1]
                    putquick "SBNC GLOBAL $arg"
                    putquick "NOTICE $nick :Done. Global notice to all bouncer users transmitted."
                }
                "check" {
                    set sbnc(nick) $nick
                    putquick "SBNC WHO"
                }
                "help" {
                    putserv "NOTICE $nick :\037sBNC help\037:"
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc add 'ident' 'realname' to add a bouncer."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc del 'ident' to delete a bouncer."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc password 'ident' to generate a new password."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc admin 'ident' to give admin rights."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc unadmin 'ident' to remove admin rights."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc global 'message' to send a global notice to all bouncer users."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc check to check if all bouncer users are available at your channel."
                    putserv "NOTICE $nick :End of list."
                }
                "default" {
                    putserv "NOTICE $nick :Error. Use $sbnc(trigger)sbnc help to see a command overview."
                }
            }
        }
        
        proc sbnc:notice { nick host hand arg dest } {
            global sbnc
            if {$nick != "-sBNC"} {
                return
            } elseif {$arg == "No such user: *" || $arg == "Done."} {
                return
            } elseif {$arg == "End of USERS."} {
                sbnc:notice:end $sbnc(nick)
            } else {
                set ident [lindex [split $arg ()] 0]
                regsub -all {@} $ident { } ident
                regsub -all {\*} $ident { } ident                
                append sbnc(db) " $ident"
            }
        }

        proc sbnc:notice:end { nick } {
            global sbnc
            set sbnc(missing) ""
            foreach user [chanlist $sbnc(chan)] {
                set idents [lindex [split [getchanhost $user $sbnc(chan)] @] 0]
                foreach ident [split $sbnc(db)] {
                    if {[string match "*$ident*" "$idents"]} {
                       lappend sbnc(missing) $idents
                    }
                }
            }
            set sbnc(mlist) ""
            foreach idents [split $sbnc(db)] {
                if {![string match "*$idents*" "$sbnc(missing)"]} {
                    putserv "SBNC SIMUL $idents JOIN $sbnc(chan)"
                }
            }
            unset sbnc(db)
            putquick "NOTICE $sbnc(nick) :Done. All bouncer users should now be available at your channel."
        }
With this Script you can manage you sbnc via public commands. :)
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

why on earth would you want to do it via an eggdrop?

I think the more logical choice would be to make sbnc spawn a client and use that as a bot.
s
spijon
Voice
Posts: 33
Joined: Sun Aug 27, 2006 9:55 pm

Custom

Post by spijon »

Greate script there dude!

Is it posible to get the output notice to something like :

Code: Select all

putquick "NOTICE $nick :The quick one: //emailaddr $ident | /server -a $sbnc(server) -g $sbnc(server) -p $sbnc(port) -w $password -d $sbnc(server) | /server $sbnc(server)"
All it needs is a @ after the ident :/

Edit:

And i was alsow thinking of a update to the add ".sbnc add ident ircnick" privmsg the info to the ircnick.
c
c0re
Voice
Posts: 16
Joined: Sun Jan 18, 2009 4:45 pm

Post by c0re »

can you make it for psybnc please
K
Kein
Voice
Posts: 21
Joined: Wed Apr 09, 2008 9:57 pm

Post by Kein »

c0re wrote:can you make it for psybnc please
Yes, but not for you.
I'm too lazy for all of this
n
n0radx
Voice
Posts: 2
Joined: Wed Jun 08, 2016 5:04 pm

Post by n0radx »

is it possible to modify the script in order to allow multiple bouncer connections ? (for example the eggdrop will connect to 10 psybnc admins - wich will remain in the partyline - and add users from them)
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

c0re wrote:can you make it for psybnc please
Have you checked psyBNC scripting? You might want something like this. It's pretty simple to add more commands as you want/need them. You may also like to check the psyBNC forum scripting category
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Post Reply