Script - to Lukemob

Do you have script in mind but no ability to make it, type in what it should do, and you might be lucky.

Script - to Lukemob

Postby sKippah » Sun Dec 21, 2008 12:26 pm

Hello Lukemob. As we talked before, here is the request, if possible. This has no influence on the channel. I will leave the IRC in the next few weeks.

as i wrote you that a friend of mine is looking for a script for sbnc. He wants to give a small amount of Users a bnc, and because he will do this alone he wants an, more ore less, automated script. Maybe it is possible to rewrite the sbnc script i posted at the end.

Forget all of this. isnt it easier to insert a .rbnc add and a .rbnc del function ?! so he g´has the full amount of this script, mysql included, and can use the script in emergency too

Thats the script, i was using

Code: Select all
#                AAA               lllllll
#               A:::A              l:::::l
#              A:::::A             l:::::l
#             A:::::::A            l:::::l
#            A:::::::::A            l::::l     eeeeeeeeeeee  xxxxxxx      xxxxxxx
#           A:::::A:::::A           l::::l   ee::::::::::::ee x:::::x    x:::::x
#          A:::::A A:::::A          l::::l  e::::::eeeee:::::eex:::::x  x:::::x
#         A:::::A   A:::::A         l::::l e::::::e     e:::::e x:::::xx:::::x
#        A:::::A     A:::::A        l::::l e:::::::eeeee::::::e  x::::::::::x
#       A:::::AAAAAAAAA:::::A       l::::l e:::::::::::::::::e    x::::::::x
#      A:::::::::::::::::::::A      l::::l e::::::eeeeeeeeeee     x::::::::x
#     A:::::AAAAAAAAAAAAA:::::A     l::::l e:::::::e             x::::::::::x
#    A:::::A             A:::::A   l::::::le::::::::e           x:::::xx:::::x
#   A:::::A               A:::::A  l::::::l e::::::::eeeeeeee  x:::::x  x:::::x
#  A:::::A                 A:::::A l::::::l  ee:::::::::::::e x:::::x    x:::::x
# AAAAAAA                   AAAAAAAllllllll    eeeeeeeeeeeeeexxxxxxx      xxxxxxx
#
#
# Mein erstes größeres TCL Script. Für die Einstellung von sBNC.
# Es überprüft jede halbe und volle Stunde ob alle User im Homechan sind.
#
# Danke an:
# Nighty - Für die Idee und das Simul-all script.
# Wanne - Für die mysqlconnect.tcl ;)
#
# Dieses Script benötigt die check.tcl von mir :)
#
# Commands:
#
# ?sbnc check
# - Überprüft ob jeder User im Homechan ist.
# ?sbnc simul Ident/all command
# - Simuls das angegebene Command an dem User.
# ?sbnc add Ident ?Nick? ?Realname?
# - Fügt einen neuen User hinzu. Nick = Der User, der die Zugangsdaten bekommt. Wenn kein Nick angegeben wird dein Nick genutzt.
# ?sbnc del Ident
# - Löscht einen Bouncer.
# ?sbnc suspend ident ?reason?
# - Suspendiert einen Bouncer mit dem Grund. Wenn kein Grund angegeben, der Standartgrund wird genutzt.
# ?sbnc unsuspend ident
# - Hebt die suspendierung eines Users wieder auf.
# ?sbnc resetpass ident ?nick?
# - Resetet das Passwort des Users.. Nick = Der User, der das neue Passwort bekommt. Wen kein Nick angegeben wird dein Nick genutzt.
# ?sbnc global Nachricht
# - Sendet eine Nachricht an alle User.
# ?sbnc status
# - Shows a status message.
# ?sbnc info ident
# - Zeigt Informationen zur angegebenen Ident.
# ?sbnc admin Ident
# - Gibt einem User Adminrechte
# ?sbnc unadmin Ident
# - Entfernt Adminrechte eines Users.
# ?sbnc list
# - Zeigt alle Bouncer.
# ?sbnc slist
# - Zeigt eine Liste alles suspendet Bouncer.
# ?sbnc welcome on/off
# - Aktiviert, dass der Bot in die Willkommens Message von Q schreibt, wieviele Bouncer noch verfügbar sind. ( Der Bot brauch +m bei Q! )
# ?sbnc version
# - Zeigt die aktuelle Version des Scripts.

# You didnt need to change this 2 settings.
set sbnc(author)      "WindowsLive"
set sbnc(version)      "2.8b MYSQL+Autoupdate"

# > Binds
bind PUB n|S $sbnc(global,trigger)sbnc sbnc:pub
bind time - "* * * * *" sbnc:timed
bind MSGM - {*} sbnc:qry
# < Binds

# > Flags
setudef flag welcome
setudef flag topic2
setudef str topic
setudef flag topicq
# < Flags

# Dont change anything, thanks!
# Dont change anything, thanks!
# Dont change anything, thanks!
# Dont change anything, thanks!


# > Procs
proc sbnc:pub { nick host hand chan arg } {
   global sbnc
   set function   [string tolower [lindex [split $arg] 0]]
#   if {[string tolower $chan] != [string tolower $sbnc(global,home)]} { return }
   if {[string tolower $chan] != [string tolower $sbnc(global,achan)]} { return }
   switch -- $function {
      check {
         putlog "$nick used sbnc check."
         putquick "SBNC simulall join $sbnc(global,home)"
         sbncmsg $chan 2 "Done. Alle [getbnc] User sind nun in diesem Channel."
      }

      simul {
         set user [lindex [split $arg] 1]
         set setting [lindex [split $arg] 4]
         set command [lrange [split $arg] 2 end]
         if {$user == "" || $command == ""} {
            sbncmsg $chan 2 "Falsche Eingabe. Benutz: $sbnc(global,trigger)sbnc simul ident command"
            return
         }
         if {$user == "all"} {
            putquick "SBNC simulall $command"
            sbncmsg $chan 2 "Done."
            putlog "!!! $nick hat SIMUL ALL benutzt. Command: $command !!!!!!"
            return
         }
         if {[bncexists $user] == "0"} { sbncmsg $chan 1 "$user gibt es nicht." ; return }
         putlog "!!!! $nick hat SIMUL $user benutzt. Command: $command !!!!!"
         putquick "SBNC unlock $user :$setting"
         putquick "SBNC simul $user :$command"
         putquick "SBNC lock $user :$setting"
         sbncmsg $chan 2 "Done."
      }
      add {
         set ident [lindex [split $arg] 1]
         set inhere [lindex [split $arg] 2]
         set realname $sbnc(global,realname)
         set vhost [lrange [split $arg] 3 end]
         set bncs [getbnc]
         if {$ident == ""} {
            sbncmsg $chan 2 "Falsche Eingabe. Benutz: $sbnc(global,trigger)sbnc add ident ?user? ?vhost?"
            return
         }
         if {$vhost == ""} {
            set vhost $sbnc(global,vhost)
         }
         if {$inhere == ""} {
            set inhere $nick
         }
         if {![onchan $inhere $sbnc(global,home)]} {
            sbncmsg $chan 2 "Fehler. $inhere ist nicht in diesem Channel."
            return
         }
         if {[bncexists $ident] == 1} {
            sbncmsg $chan 1 "Fehler. Da ist bereits ein Bouncer mit Ident $ident ."
            return
         }
         if {[getbnc] == $sbnc(global,max)} {
            sbncmsg $chan 2 "Fehler. Es sind bereits $sbnc(global,max) Bouncer hinzugefügt."
            return
         }
         if {[string length $ident] > 9} {
            sbncmsg $chan 1 "Fehler. Die Ident darf nur max. 9 Zeichen lang sein."
            return
         }
         set pass [randstring 8]

         putlog "$nick fügte bouncer $ident hinzu. Realuser: $inhere"
         putquick "SBNC adduser $ident $pass"
         putquick "SBNC simul $ident sbnc set realname $realname"
         putquick "SBNC simul $ident sbnc set vhost $vhost"
         putquick "SBNC simul $ident sbnc set server $sbnc(global,irc)"
         if {$sbnc(lock) == "1"} {
            foreach x $sbnc(locksetting) {
               putquick "SBNC lock $ident $x"
            }
         }
         if {$sbnc(global,ifaceon) == "1"} {
            putquick "PRIVMSG $inhere :Your BNC! Sponsored by $sbnc(global,home)."
            putquick "PRIVMSG $inhere :Server: $sbnc(global,sbncip) | Port: $sbnc(global,sbncport)"
            putquick "PRIVMSG $inhere :User/Identd: $ident | Password: $pass"
            putquick "PRIVMSG $inhere :Webinterface: $sbnc(global,iface)"
         } else {
            putquick "PRIVMSG $inhere :Your BNC! Sponsored by $sbnc(global,home)."
            putquick "PRIVMSG $inhere :Server: $sbnc(global,sbncip) | Port: $sbnc(global,sbncport)"
            putquick "PRIVMSG $inhere :User/Identd: $ident | Password: $pass"
         }
         add:bnc $ident $nick $inhere [unixtime] 0
         sbncmsg $chan 2 "Done. Bouncer $ident hinzugefügt | Bouncer [getbnc] / $sbnc(global,max)"
         utimer 20 [list putquick "SBNC simul $ident JOIN $sbnc(global,home)" ]
         topic:set
         if {[channel get $sbnc(global,home) welcome]} {
            putserv "PRIVMSG Q :chanflags $sbnc(global,home) +w"
            set free [expr {$sbnc(global,max) - [getbnc]}]
            putserv "PRIVMSG Q :welcome $sbnc(global,home) WelCome ² 4#bnc4you - For a free BNC type - ?rules (eng) - ?regeln (de) -  Available Bouncer: $free"
         }
      }
      del {
         set ident [lindex [split $arg] 1]
         set bncs [getbnc]
         if {$ident == ""} {
            sbncmsg $chan 2 "Fehler. Benutze: $sbnc(global,trigger)sbnc del ident"
            return
         }
         if {$ident == $sbnc(botident)} {
            sbncmsg $chan 1 "Haha. Du kannst mich nicht löschen!"
            return
         }
         if {[issuspended $ident] == "1"} {
            unsuspend $ident
         }
         if {[sbnc:locked $ident]} {
            sbncmsg $chan 1 "Fehler. $ident ist gelockt und kann nicht gelöscht werden!"
            return
         }
         if {[del:bnc $ident] == "1"} {
            putlog "$nick löschte User $ident"
            putquick "SBNC deluser $ident"
            sbncmsg $chan 1 "Done. $ident wurde gelöscht."
            topic:set
            if {[channel get $sbnc(global,home) welcome]} {
               putserv "PRIVMSG Q :chanflags $sbnc(global,home) +w"
               set free [expr {$sbnc(global,max) - [channel get $sbnc(global,home) bncs]}]
                            putserv "PRIVMSG Q :welcome $sbnc(global,home) Willkommen bei 4#bnc4you - Besuch uns auf www.bnc4you.info. Verfügbare Bouncer: $free"

            }
         } else {
            sbncmsg $chan 1 "Kann $ident nicht finden!"
         }
      }
      suspend {
         set ident [lindex [split $arg] 1]
         set reason [lrange [split $arg] 2 end]
         set bncs [getbnc]
         if {$ident == ""} {
            sbncmsg $chan 2 "Fehler. Benutze: $sbnc(global,trigger)sbnc suspend ident ?reason?"
            return
         }
         if {$reason == ""} {
            set reason "$sbnc(global,sreason)"
         }
         if {$ident == "$sbnc(botident)"} {
            sbncmsg $chan 1 "Haha. Du kannst mich nicht suspendieren!"
            return
         }
         if {[issuspended $ident] == "1"} {
            sbncmsg $chan 1 "Fehler. $ident ist bereits suspendet."
            return
         }
         if {[suspend $ident [unixtime] $nick $reason] == "1"} {
            putlog "$nick suspendiert $ident mit Grund $reason"
            putquick "SBNC suspend $ident $reason"
            sbncmsg $chan 1 " Done."
            return
         } else {
            sbncmsg $chan 1 "Konnte $ident nicht finden!"
         }
      }
      unsuspend {
         set ident [lindex [split $arg] 1]
         set bncs [getbnc]
         set suspended [getsuspend]
         if {$ident == ""} {
            sbncmsg $chan 2 "Fehler. Benutz: $sbnc(global,trigger)sbnc unsuspend ident"
            return
         }
         if {$ident == "$sbnc(botident)"} {
            sbncmsg $chan 1 "Haha. Ich bin nicht suspendiert...!"
            return
         }
         if {[issuspended $ident] == "0"} {
            sbncmsg $chan 1 "$ident ist nicht suspendiert."
            return
         }
         if {[unsuspend $ident] == "1"} {
            putlog "$nick unsuspendiert User $ident"
            putquick "SBNC unsuspend $ident"
            sbncmsg $chan 1 " Done."
            return
         }

      }
      resetpass {
         set ident [lindex [split $arg] 1]
         set user [lindex [split $arg] 2]
         if {$ident == ""} {
            sbncmsg $chan 2 "Fehler. Benutz: $sbnc(global,trigger)sbnc resetpass ident ?user?"
            return
         }
         if {$user == ""} {
            set user "$nick"
         }
         if {![onchan $user $sbnc(global,home)]} {
            sbncmsg $chan 1 "Fehler. $user ist nicht in $sbnc(global,home)"
            return
         }
         if {[bncexists $ident] == "1"} {
            set temppass [randstring 8]
            putlog "$nick resetet Passwort von $ident . Neues Passwort: $temppass . Daten wurden $user gesendet"
            putquick "SBNC resetpass $ident $temppass"
            putquick "PRIVMSG $user :Hi. Your  $sbnc(global,home) Bouncer Password has been reseted!"
            putquick "PRIVMSG $user : IP: $sbnc(global,sbncip) | Port: $sbnc(global,sbncport) "
            putquick "PRIVMSG $user : Ident: $ident | Your new Password is $temppass"
            if {$sbnc(global,ifaceon) == "1"} {
               putquick "PRIVMSG $user : Webinterface: $sbnc(global,iface)"
            }
            sbncmsg $chan 2 " Done. Passwort von $ident geändert. Neues Passwort an $user gesendet."
            return
         } else {
            sbncmsg $chan 1 "Kann $ident nicht finden!"
         }
      }
      global {
         set message [lrange [split $arg] 1 end]
         if {$message == ""} {
            sbncmsg $chan 1 " Du hast deine Nachricht vergessen!"
            return
         }
         putlog "$nick verschickt globale message: $message"
         putquick "SBNC global $message"
         sbncmsg $chan 1 " Done. [getbnc] User haben diese Nachricht erhalten."
      }
      iface {
         if {$sbnc(global,ifaceon) == "1"} {
            sbncmsg $chan 1 "Webinterface: $sbnc(global,iface)"
         } else {
            sbncmsg $chan 1 "Zur Zeit ist das Webinterface nicht verfügbar."
         }
      }
      stats {
         putquick "PRIVMSG -sBNC :statusinfo"
         utimer 2 {
            sbncmsg $sbnc(global,home) 1 "Zur Zeit gibt es [getbnc] Bouncer. Möglich sind $sbnc(global,max) Bouncer. [expr {$sbnc(global,max) - [getbnc]}] freie Bouncer."
            if {[getsuspend] < "2" && [getsuspend] > "0"} {
               sbncmsg $sbnc(global,home) 1 "[getsuspend] Bouncer ist suspendiert."
            } else {
               sbncmsg $sbnc(global,home) 1 "[getsuspend] Bouncer sind suspendiert."
            }
            sbncmsg $sbnc(global,home) 1 "$sbnc(connected) User sind connectet. $sbnc(qnet) Bouncer sind zum Quakenet connected."
            if {$sbnc(admins) < "2"} {
               sbncmsg $sbnc(global,home) 1 "Es gibt $sbnc(admins) Admin."
            } else {
               sbncmsg $sbnc(global,home) 1 "Es gibt $sbnc(admins) Admins."
            }
         }
      }
      lock {
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg $chan 1 "$sbnc(global,trigger)sbnc lock ?ident?"
            return
         }
         if {[bncexists $ident]} {
            if {![sbnc:locked $ident]} {
               sbnc:lock $ident
               sbncmsg $chan 1 "Done. Bouncer mit Ident $ident wurde erfolgreich gelocked."
               return
            } else {
               sbncmsg $chan 1 "Fehler. $ident ist bereits gelocked."
            }
         } else {
            sbncmsg $chan 2 "Es gibt keinen Bouncer mit Ident $ident"
         }
      }
      unlock {
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg $chan 1 "$sbnc(global,trigger)sbnc unlock ?ident?"
            return
         }
         if {[bncexists $ident]} {
            if {[sbnc:locked $ident]} {
               sbnc:unlock $ident
               sbncmsg $chan 1 "Done. Bouncer mit Ident $ident wurde erfolgreich delocked."
               return
            } else {
               sbncmsg $chan 1 "Fehler. $ident ist nicht gelocked."
            }
         } else {
            sbncmsg $chan 2 "Es gibt keinen Bouncer mit Ident $ident"
         }
      }
      info {
         set bnc [lindex [split $arg] 1]
         if {$bnc == ""} {
            sbncmsg $chan 1 "Fehler. Benutz: $sbnc(global,trigger)sbnc info ident"
            return
         }
         set infobla [infos $bnc]
         if {$infobla != "0"} {
            if {[issuspended $bnc] == "0"} {
               set issuspended "nein"
               putquick "PRIVMSG -sBNC :infos $bnc"
            } else {
               set issuspended "ja"
               set susbla [susinfo $bnc]
               set sreason [lrange [split $susbla] 3 end]
               set suspender [lindex [split $susbla] 2]
               set sdate [lindex [split $susbla] 1]
            }
            set bnc2 [lindex [split $infobla] 0]
            set ersteller [lindex [split $infobla] 1]
            set real [lindex [split $infobla] 2]
            set suspended [lindex [split $infobla] 3]
            set admin [lindex [split $infobla] 4]
            set datum [lindex [split $infobla] 5]
            if {$admin == "1"} { set admin "ja" } else { set admin "nein" }
            if {[sbnc:locked $bnc]} {
               sbncmsg $chan 1 "Infos über: $bnc2 | Erstellt am [ctime $datum] von $ersteller | Realnick: $real | Admin: $admin | Suspendiert: $issuspended | $bnc ist gelockt."
            } else {
               sbncmsg $chan 1 "Infos über: $bnc2 | Erstellt am [ctime $datum] von $ersteller | Realnick: $real | Admin: $admin | Suspendiert: $issuspended"
            }
            if {$issuspended == "ja"} {
               sbncmsg $chan 1 "Suspendiert von $suspender am [ctime $sdate] | Grund: $sreason"
               return
            }
            utimer 2 { sbncmsg $sbnc(global,achan) 1 "Connected zu $sbnc(ninfo) unter Nick $sbnc(nick) | Letzter Login: $sbnc(llogin) | Client ist $sbnc(isda)" }
         } else {
            sbncmsg $chan 1 "Kann $bnc nicht finden."
         }
      }
      admin {
         if {![matchattr $hand n]} { return }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg $chan 1 "Fehler. Benutz: $sbnc(global,trigger)sbnc admin Ident"
            return
         }
         if {[admin $ident] == "1"} {
            putquick "SBNC ADMIN $ident"
            sbncmsg $chan 1 "Done. $ident ist nun Admin."
            return
         } else {
            sbncmsg $chan 1 "Kann $ident nicht finden!"
         }
      }
      unadmin {
         if {![matchattr $hand n]} { return }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg $chan 1 "Fehler. Benutz: $sbnc(global,trigger)sbnc unadmin Ident"
            return
         }
         if {$ident == "$sbnc(botident)"} {
            sbncmsg $chan 1 "Haha. Du kannst meine Rechte nicht removen!"
            return
         }
         if {[unadmin $ident] == "1"} {
            putquick "SBNC UNADMIN $ident"
            sbncmsg $chan 1 "Done. $ident ist kein Admin mehr.."
            return
         } else {
            sbncmsg $chan 1 "Kann $ident nicht finden!"
         }
      }
      update {
         set ::sbnc(updatetimer) [utimer 5 [list sbncmsg $::sbnc(global,home) 1 "Keine neue Version des sBnc Scripts verfügbar."]]
         sbnc:autoupdate
         sbncmsg $::sbnc(global,home) 1 "Update gestartet - Bitte warten! :\)"
      }
      welcome {
         if {![matchattr $hand n]} { return }
         set funktion [lindex [split $arg] 1]
         switch -- $funktion {
            on {
               if {![channel get $sbnc(global,home) welcome]} {
                  if {![onchan Q $sbnc(global,home)]} {
                     sbncmsg $chan 1 "Fehler. Du kannst Welcome nicht aktivieren. Q benötigt."
                     return
                  }
                  putquick "PRIVMSG Q :chanflags $sbnc(global,home) +w"
                  channel set $sbnc(global,home) +welcome
                  sbncmsg $chan 1 "Welcome Message ist nun aktiviert. Ich brauche +m bei Q!"
               } else {
                  sbncmsg $chan 1 "Welcome Message ist bereits aktiviert."
                  return
               }
            }
            off {
               if {[channel get $sbnc(global,home) welcome]} {
                  putquick "PRIVMSG Q :chanflags $sbnc(global,home) -w"
                  channel set $sbnc(global,home) -welcome
                  sbncmsg $chan 1 "Welcome Message wurde deaktiviert.."
               } else {
                  sbncmsg $chan 1 "Welcome Message ist bereits deaktiviert.."
                  return
               }
            }
            set {
               if {![channel get $sbnc(global,home) welcome]} {
                  sbncmsg $chan 1 "Sbnc Q welcome ist nicht aktiviert."
                  return
               }
               putquick "PRIVMSG Q :chanflags $sbnc(global,home) +w"
               set free [expr {$sbnc(global,max) - [channel get $sbnc(global,home) bncs]}]
               putquick "PRIVMSG Q :welcome $sbnc(global,home) Es stehen noch $free Bouncer zur Verfuegung. Besuch uns auf www.bnc4you.info für mehr Infos."
               sbncmsg $chan 1 "Done."
            }
            default {
               if {[channel get $sbnc(global,home) welcome]} {
                  set status aktiviert
               } else {
                  set status deaktiviert
               }
               sbncmsg $chan 1 "Q welcome Message ist zur Zeit $status."
               sbncmsg $chan 1 "Benutze: $sbnc(global,trigger)sbnc welcome on/off | set."
            }
         }
      }
      topic {
         if {![matchattr $hand n]} { return }
         set funktion [lindex [split $arg] 1]
         switch -- $funktion {
            on {
               if {![channel get $sbnc(global,home) topic2]} {
                  channel set $sbnc(global,home) +topic2
                  channel set $sbnc(global,home) topic "topic $sbnc(global,home)"
                  sbncmsg $chan 1 "Topic aktiviert. Das Topic wurde gespeichert."
               } else {
                  sbncmsg $chan 1 "Topic ist bereits aktiviert."
                  return
               }
            }
            off {
               if {[channel get $sbnc(global,home) topic2]} {
                  channel set $sbnc(global,home) -topic2
                  sbncmsg $chan 1 "Topic deaktiviert."
               } else {
                  sbncmsg $chan 1 "Topic ist bereits deaktiviert."
                  return
               }
            }
            q {
               if {![channel get $sbnc(global,home) topic2]} {
                  sbncmsg $chan 1 "Du musst das Topic script erst aktivieren! ?sbnc topic on"
                  return
               }
               if {![onchan Q $sbnc(global,home)]} {
                  sbncmsg $chan 1 "Du brauchst Q für diese funktion."
                  return
               }
               if {[lindex [split $arg] 2] == "on"} {
                  if {[channel get $sbnc(global,home) topicq]} {
                     sbncmsg $chan 1 "Das Topic wird bereits über Q gesetzt."
                     return
                  } else {
                     channel set $sbnc(global,home) +topicq
                     sbncmsg $chan 1 "Das Topic wird nun über Q gesetzt."
                     return
                  }
               }
               if {[lindex [split $arg] 2] == "off"} {
                  if {![channel get $sbnc(global,home) topicq]} {
                     sbncmsg $chan 1 "Das Topic wird bereits nicht über Q gesetzt.."
                     return
                  } else {
                     channel set $sbnc(global,home) -topicq
                     sbncmsg $chan 1 "Das Topic wird nun nichtmehr über Q gesetzt."
                     return
                  }
               }
            }
            save {
               if {![channel get $sbnc(global,home) topic2]} {
                  sbncmsg $chan 1 "Das Topicscript ist nicht aktiviert."
                  return
               }
               set topic [topic $sbnc(global,home)]
               if {![string match *:status:* $topic]} {
                  sbncmsg $chan 1 "Im Topic muss :status: vorkommen!"
                  return
               }
               channel set $sbnc(global,home) topic "$topic"
               sbncmsg $nick 1 "[channel get $sbnc(global,home) topic] wurde als Topic gespeichert."
               topic:set
            }
            set {
               set topic [lrange [split $arg] 2 end]
               putlog "$topic"
               if {[llength $topic] > 250} {
                  sbncmsg $chan 1 "Das Topic darf nur max. 250 Buchstaben lang sein!"
                  return
               }
               if {[llength $topic] < 10} {
                  sbncmsg $chan 1 "Bitte gib mind. 10 Buchstaben ein."
                  return
               }
               if {![string match *:status:* $topic]} {
                  sbncmsg $chan 1 "Im Topic muss :status: vorkommen!"
                  return
               }
               channel set $sbnc(global,home) topic "$topic"
               topic:set
               sbncmsg $chan 1 "Done."
            }
            default {
               if {[channel get $sbnc(global,home) topic2]} {
                  set status aktiviert
               } else {
                  set status deaktiviert
               }
               sbncmsg $chan 1 "Topic ist zur Zeit $status."
               if {$status == "aktiviert"} {
                  sbncmsg $chan 1 "Gespeicherte Topic: [channel get $sbnc(global,home) topic]"
               }
               if {[channel get $sbnc(global,home) topicq]} {
                  sbncmsg $chan 1 "Das Topic wird über Q gesetzt."
               } else {
                  sbncmsg $chan 1 "Das Topic wird nicht über Q gesetzt."
               }
               sbncmsg $chan 1 "Benutze: $sbnc(global,trigger)sbnc topic on/off | set | save | q."
            }
         }
      }
      idlers {
         set d [lindex [split $arg] 1]
         if {$d == ""} { set d "3"}
         if {![isnumber $d]} { sbncmsg $chan 1 "Bitte gib eine valide Zahl ein!" ; return }
         putquick "PRIVMSG -sBNC :idlers $d"
         sbncmsg $nick 1 "Nicht genutzte BNCs der letzten $d Tage "
         utimer 2 {
            sbncmsg $sbnc(global,achan) 1 "Idle Bouncer sind: $sbnc(idlers)"         }
      }
      list {
         foreach x [bnclist] {
            lappend ids $x
         }
         if {![info exists ids]} {
            sbncmsg $chan 1 "Kein Bouncer geadded."
            return
         }
         while {[llength $ids] > 0} {
            set p [lrange $ids 0 10]
            sbncmsg $nick 1 "\002Userlist:\002 [join $p ", "]"
            set ids [lreplace $ids 0 10]
         }

      }
      slist {
         foreach x [sbnclist] {
            lappend ids $x
         }
         if {![info exists ids]} {
            sbncmsg $nick 1 "Kein Bouncer suspended."
            return
         }
         while {[llength $ids] > 0} {
            set p [lrange $ids 0 10]
            sbncmsg $nick 1 "\002Suspended Userlist:\002 [join $p ", "]"
            set ids [lreplace $ids 0 10]
         }
      }
      kill {
         set ident [lindex [split $arg] 1]
         if {$ident == ""} { sbncmsg $chan 1 "Benutze: ?sbnc kill Ident"
            return
         }
         if {[bncexists $ident] == "1"} {
            putquick "SBNC KILL $ident"
            sbncmsg $chan 1 "Done. $ident wurde vom Bouncer disconnected."
            return
         } else {
            sbncmsg $chan 1 "Kann $ident nicht finden!"
         }
      }
      version {
         putquick "PRIVMSG $chan :\001ACTION benutzt sBNC-Admin-Control \(deutsch\) von $sbnc(author) - #BundesTrojaner - Version: $sbnc(version)"
      }
      adduser {
         if {![matchattr $hand n]} { return }
         set unick [lindex [split $arg] 1]
         if {$unick == ""} { putquick "NOTICE $nick :Nickname vergessen." ; return }
         if {[validuser $unick]} {
            sbncmsg $chan 1 "$unick ist bereits geadded."
            return
         }
         adduser $unick *![getchanhost $unick]
         chattr $unick -|S $chan
         sbncmsg $chan 1 "Done."
      }
      deluser {
         if {![matchattr $hand n]} { return }
         set unick [lindex [split $arg] 1]
         if {$unick == ""} { putquick "NOTICE $nick :Nickname vergessen." ; return }
         if {![validuser $unick]} {
            sbncmsg $chan 1 "$unick ist mir nicht bekannt."
            return
         }
         deluser $unick
         sbncmsg $chan 1 "Done."
      }
      ulist {
         if {![matchattr $hand n]} { return }
         sbncmsg $nick 1 "Userlist: [userlist -|S $chan]"
      }
      default {
         sbncmsg $nick 1 "$sbnc(global,trigger)sbnc check|simul|add|del|suspend|unsuspend|resetpass|global|iface|stats|lock|unlock|info|admin|unadmin|update|welcome|topic|idlers|list|slist|kill|version|adduser|deluser|ulist"
      }
   }
}

proc sbnc:qry {nickname hostname handle arguments} {
   global sbnc
   if {$nickname != "-sBNC"} { return }
   set user [lindex [split $arguments] 1]
   if {[isignore *!*@shroudbnc.info]} { killignore *!*@shroudbnc.info }
   if {[isignore *!*@shroudbnc.org]} { killignore *!*@shroudbnc.org }
   if {![validuser -sBNC]} { adduser -sBNC ; setuser -sBNC hosts "*!*@shroudbnc.info *!*@shroudbnc.org"  }
   if {![matchattr -sBNC f]} { chattr -sBNC f }
   if {[string match "*Status:*" "$arguments"]} { set sbnc(user) [lindex [split $arguments] 2] ; set sbnc(connected) [lindex [split $arguments] 5] ; set sbnc(qnet) [lindex [split $arguments] 8] ; set sbnc(admins) [lindex [split $arguments] 11]}
   if {[string match "*Infos:*" "$arguments"]} { set sbnc(ninfo) [lindex [split $arguments] 2] ; set sbnc(nick) [lindex [split $arguments] 3] ; set sbnc(isda) [lindex [split $arguments] 4] ; set sbnc(llogin) [lrange [split $arguments] 5 end]}
   if {[string match "*Idlers:*" "$arguments"]} { set sbnc(idlers) [lrange [split $arguments] 1 end] }
   if {[lindex [split $arguments] 3] == "on"} {
      if {$sbnc(admin,on) == "1"} {
         if {$sbnc(global,achan) == $sbnc(global,home)} {
            sbncmsg $sbnc(global,home) 1 "Du kannst den Internen Channel nicht als Homechannel benutzen!!!"
            return
         }
         putquick "PRIVMSG -sBNC :simul $user :privmsg $sbnc(global,achan) :\002 $user \002 hat sich eingeloggt!"

      }
   }
   if {[lindex [split $arguments] 3] == "off."} {
      if {$sbnc(admin,on) == "1"} {
         if {$sbnc(global,achan) == $sbnc(global,home)} {
            sbncmsg $sbnc(global,home) 1 "Du kannst den Internen Channel nicht als Homechannel benutzen!!!!"
            return
         }
         putquick "PRIVMSG -sBNC :simul $user :privmsg $sbnc(global,achan) :\002 $user \002 hat sich ausgeloggt!"

      }
   }
   if {[lindex [split $arguments] 1] == "removed:"} {
      if {$sbnc(admin,on) == "1"} {
         if {$sbnc(global,achan) == $sbnc(global,home)} {
            sbncmsg $sbnc(global,home) 1 "Du kannst den Internen Channel nicht als Homechannel benutzen!!!!"
            return
         }
         sbncmsg $sbnc(global,achan) 1 "\002 [lindex [split $arguments] 2] \002 wurde gelöscht und disconnected.!"
      }
   }
}

proc sbnc:timed { min hour day month year } {
   global sbnc
   if { $min == 30 } {
      putlog "Überprüfe nun, ob alle User in $sbnc(global,home) sind."
      putserv "PRIVMSG -SBNC :simulall JOIN $sbnc(global,home)"
   }
   if { $hour == "23" && $::sbnc(autoupdate) == "1"} {
      sbnc:autoupdate
   }
   if {[isignore *!*@shroudbnc.info]} { killignore *!*@shroudbnc.info }
   if { $min == 00 } {
      putlog "Überprüfe nun, ob alle User in $sbnc(global,home) sind."
      putserv "PRIVMSG -SBNC :simulall JOIN $sbnc(global,home)"
      if {![validchan $sbnc(global,home)]} {
         putlog "Fehler. $sbnc(global,home) ist kein valider Channel. Überprüfe deine Settings!"
         die "Fehler. $sbnc(global,home) ist kein valider Channel. Ueberpruefe deine Settings!"
         return
      }
      if {$sbnc(admin,on) == "1"} {
         if {[string match "*n*" "[getchanmode $sbnc(global,achan)]"]} {
            channel set $sbnc(global,achan) chanmode -n
            pushmode $sbnc(global,achan) -n
            sbncmsg $sbnc(global,achan) 1 "Brauche -n in diesem Channel!"
         }
      }
   }
}

proc topic:set { } {
   global sbnc
   if {![channel get $sbnc(global,home) topic2]} { return }
   set topic [channel get $sbnc(global,home) topic]
   set bncs [getbnc]
   set max $sbnc(global,max)
   set sbncstatus " $bncs/$max "
   regsub -all {:status:} $topic "$sbncstatus" topic
   if {[channel get $sbnc(global,home) topicq]} {
      putquick "PRIVMSG Q :settopic $sbnc(global,home) $topic"
      return
   }
   if {![isop $::botnick $sbnc(global,home)]} {
      sbncmsg $::sbnc(global,home) 1 "Ich habe kein OP und kann das Topic nicht setzen."
      return
   }
   putserv "TOPIC $sbnc(global,home) :$topic"
}

proc sbncmsg { chan queue msg } {
   if {$queue == "1"} {
      set queue "putquick"
   } elseif {$queue == "2"} {
      set queue "putserv"
   } else {
      set queue "puthelp"
   }
   if {![string match "#*" $chan]} {
      set action "notice"
   } else {
      set action "privmsg"
      set mode "[string match *c* [getchanmode $chan]]"
   }
   if {[info exists mode] && $mode == "1"} {
      $queue "$action $chan :\(sBNC\) $msg"
   } else {
      $queue "$action $chan :\002\(\002sBNC\002\)\002 $msg"
   }
}

proc sbnc:autoupdate { } {
   set size [file size "$::sbnc(dir)/sbnc.tcl"]
   catch { exec wget http://update.alexanderb.info/sbnc.tcl } unwichtig
   if {[file exists sbnc.tcl] && [file size "sbnc.tcl"] != $size && [file size "sbnc.tcl"] != "0"} {
      exec cp "sbnc.tcl" "$::sbnc(dir)/sbnc.tcl"
      exec rm sbnc.tcl
      rehash
      if {[info exists ::sbnc(updatetimer)]} {
         killutimer $::sbnc(updatetimer)
      }
      sbncmsg $::sbnc(global,home) 2 "Neue Version des sBNC Scripts heruntergeladen und erfolgreich aktualisiert."
      return 1
   }
   exec rm sbnc.tcl
   return 0
}

putlog "Sbncscript von $::sbnc(author) V$::sbnc(version) geladen"


I hope that u can help. Thank u a lot
Happy Holidays. sKip
sKippah
 

Re: Script - to Lukemob

Postby Lukemob » Sun Dec 21, 2008 4:03 pm

Ohh WindowsLive is my mate :-)) But well, it's possible to add .sbnc add/del command, yes. But what did you mean by "automatical"? Do you mean, when the user request, the bouncer is automatically created for him? Or? Please specify it more for me.. thanks
Lukemob
 

Re: Script - to Lukemob

Postby sKippah » Sun Dec 21, 2008 8:16 pm

It has the sbnc add/del trigger
with automated i meant if somebody types .sbnc <ident> he will be checked (authed / not already BNC requested) and the BNC joins the QNet and the data will be send to this user (if he exist)
And if he/she doent wants the BNC he/she can delete it too
Right now it just has the .sbnc add/del trigger for Admins only (please remember that this Script is using mysql - would be great if the automated trigger uses the mysql too )
sKippah
 

Re: Script - to Lukemob

Postby Lukemob » Wed Dec 31, 2008 3:37 pm

Just a question, this is an easy script, why do you want to use MySQL? One more thing.. I'm not sure if it's a good idea to request a bouncer for anyone by just typing a command and then the bot checks if the user is worth it. Might not be so safe.. Are you still sure you need that script?
Lukemob
 

Re: Script - to Lukemob

Postby Futz0r » Thu May 07, 2009 12:41 pm

i get error if i'm loading it


Code: Select all
[14:36] can't read "sbnc(global,trigger)": no such element in array
    while executing
"bind PUB n|S $sbnc(global,trigger)sbnc sbnc:pub"
    (file "scripts/sbnc.tcl" line 68)
    invoked from within
"source scripts/sbnc.tcl"
    (file "eggdrop.conf" line 1364)
[14:36] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)



what happing ?
Futz0r
 

Re: Script - to Lukemob

Postby Cristian » Thu May 07, 2009 3:21 pm

You can't just take a script out and use it, you need every file, scripts and variables the author made to use it.

You get the error because it is missing a variable, if you look trough the script, you see that it is missing a lot of variables.

The author is Alex and the script can be downloaded here. sbnc-ohne-eggdrop
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: Script - to Lukemob

Postby Futz0r » Thu May 07, 2009 3:36 pm

ohhh ty :)
Futz0r
 


Return to TCL Scripting Request

Who is online

Users browsing this forum: No registered users and 3 guests

cron