Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


sbnc.tcl
#1
Sad 
Bonjour à tous,

Je poste ce sujet car je me retrouve devant un problème avec un script tcl qui devrait donner des commandes public pour la gestion des users sur sBNC.
Le problème est que je pense l'avoir bien configuré ( j'ai bien dis je pense :p ) mais au moment de faire l'une des commandes, le bot me répond bien mais rien ne se passe :D.

Je vous présente le script :


tcl
#     __                     _     __        ______         _  __    _       __
#    / /   ____ ___  _______(_)___/ /____   / ____/__  ___ | |/ /   | |     / /
#   / /   / __ `/ / / / ___/ / __  / ___/  / / __/ _ \/ _ \|   /    | | /| / / 
#  / /___/ /_/ / /_/ / /  / / /_/ (__  )  / /_/ /  __/  __/   |     | |/ |/ /_ 
# /_____/\__,_/\__,_/_/  /_/\__,_/____/   \____/\___/\___/_/|_|     |__/|__/(_)
#
# sBNC Script by GeeX.
#
# | author:     GeeX                             
# | version:    2.0                         
# | web:        www.myGeeX.de                   
# | irc:        #GeeX at Quakenet               
# | contact:    www.myGeeX.de/?page_id=13         
#                                                  
# +-------------+
# | 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
# |     - (20.08.06) v1.7:   code review
# |     - (20.09.06) v1.8:   little bug fix
# |     - (24.09.06) v1.9:   bind change (notice -> msgm)
# |     - (02.05.07) v2.0:   check function deleted
# |                          added join and part function
# |                          removed declaration of realname while adding a sbnc
# |                          added declaration of bncuser to autmatically submit the sbnc data
#
# +-------------------+
# | 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)   "2.0"
        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
 
    #  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 bncuser [lindex [split $arg] 2]
                    if {$ident == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc add 'ident' ?nick?."
                        return
                    }
                    putquick "SBNC ADDUSER $ident $password"
                    putquick "SBNC SIMUL $ident SBNC SET REALNAME $sbnc(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)"
                    if {$bncuser == ""} {
                        return
                    } elseif {[onchan $bncuser $chan]} {
                        putserv "PRIVMSG $bncuser :Your BNC data, $bncuser:"
                        putserv "PRIVMSG $bncuser :Server: $sbnc(server), Port: $sbnc(port), Ident: $ident, Password: $password, Iface: $sbnc(iface)"
                        putserv "PRIVMSG $bncuser :If you need help, just join $sbnc(chan)."
                    } else {
                        putserv "NOTICE $nick :Error. $bncuser is not on $chan."
                        return
                    }
                }
                "del" {
                    set ident [lindex [split $arg] 1]
                    if {$ident == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc del 'ident'."
                        return
                    } else {
                    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}]
                    if {$ident == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc password 'ident'."
                        return
                    } else {
                        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
                    } elseif {$ident == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc admin 'ident'."
                        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
                    } elseif {$ident == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc unadmin 'ident'."
                        return
                    } else {
                        putquick "SBNC UNADMIN $ident"
                        putquick "NOTICE $nick :Done. Admin rights for user ($ident) deleted."
                    }
                }
                "global" {
		    set arg [lrange [split $arg] 1 end]
                    if {$arg == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc global 'message'."
                        return
                    } else {
                        putquick "SBNC GLOBAL $arg"
                        putquick "NOTICE $nick :Done. Global notice to all bouncer users transmitted."
                    }
                }
                "join" {
                    set sbnc(joinchan) "[lindex [split $arg] 1]"
                    if {$sbnc(joinchan) == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc join 'channel'."
                        return
                    } elseif {[string first # $sbnc(joinchan)] != 0} {
                        putserv "NOTICE $nick :Error. The channel has to start with '#'."
                        return
                    } else {
                        putserv "SBNC tcl :foreach sbnc(user) \[bncuserlist\] {setctx \$sbnc(user) ; channel add $sbnc(joinchan)}"
                        putserv "NOTICE $nick :Done. All sBNC users joined $sbnc(joinchan)."
                        return
                    }
                }
                "part" {
                    set sbnc(partchan) "[lindex [split $arg] 1]"
                    if {$sbnc(partchan) == ""} {
                        putserv "NOTICE $nick :Error. Wrong syntax. Use $sbnc(trigger)sbnc part 'channel'."
                        return
                    } elseif {[string first # $sbnc(partchan)] != 0} {
                        putserv "NOTICE $nick :Error. The channel has to start with a '#'."
                        return
                    } else {
                        putserv "SBNC tcl :foreach sbnc(user) \[bncuserlist\] {setctx \$sbnc(user) ; channel remove $sbnc(partchan)}"
                        putserv "NOTICE $nick :Done. All sBNC users parted $sbnc(partchan)."
                        return
                    }
                }
                "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 join 'chan' to join all sBNC user a specific channel."
                    putserv "NOTICE $nick :Use $sbnc(trigger)sbnc part 'chan' to part all sBNC user a specific channel."
                    putserv "NOTICE $nick :End of list."
                }
                "default" {
                    putserv "NOTICE $nick :Error. Use $sbnc(trigger)sbnc help to see a command overview."
                }
            }
        }


Pour les informations j'ai bien mis le port du sBNC ainsi que l'ip du server ou il se trouve et le réseau irc en question.

Si je pouvais avoir un petit coup de main à comprendre le problème :p

Merci d'avance.
#2
bonjour,
as tu essayé de remplacé :

tcl
set sbnc(trigger)   "\!"

par

tcl
set sbnc(trigger)   "!"


heu .. question peut être un peut bête essaye
Quote:/say !sbnc help

pour voir si cela viendrais pas des couleurs,parfois il arrive que les couleurs d'écriture pose problème. (à testé,ont ne sais jamais)
La différence entre Linux et Windows ,c'est que Linux c'est comme une belle fille , il faut l'apprivoiser , la comprendre , la séduire tandis que Windows , c'est comme une prostitué , il faut payer et surtout bien se protéger.
#3
Merci de ta réponse fedora mais pour ce qui est des binds y'a pas de problèmes, sauf que le sbnc réagi pas :/ exemple :

<kipof> *sbnc add teste teste
-Oxys- Done. New bnc added.
-Oxys- Server: bnc.kipof.net, Port: 65535, Ident: teste, Password: 5741
-Oxys- Error. teste is not on #quizz.

voilà le problème :/
#4
Quote:teste is not on #quizz.

il indique que teste n'est pas sur le salon #quizz,donc peut être il existe pas ? ou pas sur le salon
La différence entre Linux et Windows ,c'est que Linux c'est comme une belle fille , il faut l'apprivoiser , la comprendre , la séduire tandis que Windows , c'est comme une prostitué , il faut payer et surtout bien se protéger.
#5
Pour cela c'est ok, j'ai pris des pseudos qui se trouvent sur le chan, mais le sbnc réagi pas au bot, pourtant ils sont sur la même machine :/


Forum Jump:


Users browsing this thread: 1 Guest(s)