Guest User

Untitled

a guest
Dec 12th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 6.76 KB | None | 0 0
  1. #************************************#
  2. # Gestion.Bot V3.                    #
  3. #                                    #
  4. # Système de NameSpace.              #
  5. # Message en msgcat.                 #
  6. # Chan-Log.                          #
  7. # Anti-Flood commandes.              #
  8. # Si le salon de log et en +c le bot #
  9. # annonce quand même sans couleurs.  #
  10. # Nouveau système de blacklist.      #
  11. # Gestion de fichier plus simple.    #
  12. # Système d'auto-voice.              #
  13. # Les TCL sont en plusieurs parties. #
  14. # Système de welcome unique pour     #
  15. # Chaque salon prédéfini.            #
  16. # Plus de flag utilisation de level. #
  17. # Version spécial que pour FaNaTiC.  #
  18. #************************************#
  19.  
  20. namespace eval ::gestion {
  21.    
  22.     # Avant toutes configuration ci dessous veuillez lire le fichier : introduction.txt CECI ET TRES IMPORTANT.
  23.  
  24.     # A combien désire tu mettre l'anti-flood commandes.
  25.     # Activé l'Auto-Voice si oui mettez 1 sinon 0.
  26.    
  27.     # Nous vérifions si ya le package requis pour le msgcat.
  28.     package require msgcat
  29.    
  30.     # Nous mettons la langue de msgcat en français.
  31.     ::msgcat::mclocale fr
  32.    
  33.     # Version du TCL.
  34.     variable script_name "\037\0034Gestion.Bot V3.0\037\0034"
  35.     # Commandes chars Exemple "." ou "!" Ce qui donnera par exemple : .op/!op.
  36.     variable cmdschar "!"
  37.     # Nom de l'admin du bot.
  38.     variable admin "alias_angelius"
  39.     # Nom du salon de log du Robot.
  40.     variable chanlog "#back-geeks"
  41.     # Port PL.
  42.     variable port "3535"
  43.     # Levels des accès.
  44.     # /!\ Veuillez ne pas modifié ceci merci. /!\
  45.     # Admin
  46.     set level(admin) "1000"
  47.     # Owner
  48.     set level(owner) "500"
  49.     # Master
  50.     set level(master) "300"
  51.     # Opérateur
  52.     set level(operateur) "200"
  53.     # Les Procédures.
  54.     # Procédure XTRA.
  55.     proc [namespace current]::isauth {hand} {
  56.         if {[getuser $hand XTRA AUTH] eq "OFF"} {return 0}
  57.             if {[getuser $hand XTRA AUTH] eq "ON"} {return 1}
  58.     }
  59.     # Système d'authentification.
  60.     proc auth {nick host hand arg} {
  61.     variable chanlog
  62.     variable port
  63.     set arg [gbfilter $arg]
  64.     set pseudo [lindex $arg 0]
  65.     set chan [lindex $arg 2]
  66.     set pass [lindex $arg 1]
  67.     set args [split $arg]
  68.     if {[llength $args] != 2} {
  69.         putserv "notice $nick :[::msgcat::mc ErrorAuth $::botnick]"
  70.         return 0
  71.     }
  72.     if {[nick2hand $pseudo] eq "*"} {
  73.         putserv "notice $nick :[::msgcat::mc NoAxx $nick]"
  74.         retrun 0
  75.     }
  76.     if {![passwdok $pseudo $pass]} {
  77.         putserv "notice $nick :[::msgcat::mc ErrorPass]"
  78.         return 0
  79.     }
  80.     if {![string match -nocase [lindex [getuser $pseudo HOSTS] 0] "$nick!$host"]} {
  81.         putserv "notice $nick :[::msgcat::mc ErrorHost]"
  82.         return 0
  83.     }
  84.     if {[getuser $pseudo XTRA AUTH] eq "ON"} {
  85.         putserv "notice $nick :[::msgcat::mc ErrorDejaAuth]"
  86.         return 0
  87.     }
  88.     if {[getuser $hand XTRA SUSPEND] eq "ON"} {
  89.         putserv "notice $nick :[::msgcat::mc SuspendOn $nick]"
  90.         return 0
  91.     }
  92.     puthelp "notice $nick :[::msgcat::mc Auth $nick]"
  93.     puthelp "privmsg $chanlog :[::msgcat::mc AuthLog $hand]"
  94.     puthelp "privmsg $chanlog :[::msgcat::mc ChanLog] [::msgcat::mc AxxPl $nick]"
  95.     setuser $pseudo XTRA AUTH ON;
  96.     setuser $hand XTRA SEEN [clock format [clock seconds] -format "le %d/%m/%Y à %Hh%M"]
  97.     #chattr $hand +p
  98.     save
  99.     #listen $port users
  100.     puthelp "privmsg $nick :\001DCC CHAT chat [myip] $port\001"
  101.     return
  102.     }
  103.     # Procédure déauthentification.
  104.     proc deauth { nick host hand arg } {
  105.         variable chanlog
  106.         set arg [gbfilter $arg]
  107.         set args [split $arg]
  108.         set pseudo [lindex $arg 0]
  109.         set pass [lindex $args 1]
  110.         if {[llength $args] != 2} {
  111.             putserv "notice $nick :[::msgcat::mc ErrorDeauth $::botnick]"
  112.             return 0
  113.         }
  114.         if {[nick2hand $pseudo] eq "*"} {
  115.             putserv "notice $nick :[::msgcat::mc NoAxx $nick]"
  116.             return 0
  117.         }
  118.         if {![passwdok $pseudo $pass]} {
  119.             putserv "notice $nick :[::msgcat::mc ErrorPass]"
  120.             return 0
  121.         }
  122.         if {[getuser $hand XTRA auth] eq "ON"} {
  123.             putserv "notice $nick :[::msgcat::mc AuthOff $nick]"
  124.             putserv "privmsg $chanlog :[::msgcat::mc DeauthLog $hand]"
  125.             setuser $pseudo XTRA AUTH OFF;
  126.             #chattr $hand -p
  127.             save
  128.             #boot $hand "Vous êtes déauthentifié,vous ne pouvez rester en Party-Line."
  129.             return
  130.         }
  131.     }
  132.        
  133.     # Procédure Filter.
  134.     proc gbfilter {x {y ""} } {
  135.         for {set i 0} {$i < [string length $x]} {incr i} {
  136.             switch -- [string index $x $i] {
  137.                 "\"" {append y "\\\""}
  138.                 "\\" {append y "\\\\"}
  139.                 "\[" {append y "\\\["}
  140.                 "\]" {append y "\\\]"}
  141.                 "\} " {append y "\\\} "}
  142.                 "\{" {append y "\\\{"}
  143.                 default {append y [string index $x $i]}
  144.             }
  145.         }
  146.         return $y
  147.     }
  148.     # Procédure réinitialisation des accès du Bot.
  149.     proc joindeauth {nick host hand chan} {
  150.         variable chanlog
  151.         if {$nick=="$::botnick"} {
  152.             putserv "privmsg $chanlog :[::msgcat::mc DeauthJoin]"
  153.             putserv "privmsg $chanlog :[::msgcat::mc DeauthJoin2]"
  154.             foreach user [userlist * $chan] {
  155.                 setuser $user XTRA AUTH OFF
  156.                 #boot $user "Vous êtes déauthentifié,vous ne pouvez rester en Party-Line."
  157.             }
  158.         }
  159.     }
  160.     # Déauthentification au quit d'une personnes ayant un accès.
  161.     proc quitdeauth { nick uhost hand chan {msg ""}} {
  162.         variable chanlog
  163.         if {[matchattr $hand o|o $chan] && [isauth $hand]} {
  164.             setuser $hand XTRA AUTH OFF
  165.             putserv "privmsg $chanlog :[::msgcat::mc DeauthQuit $hand]"
  166.         }
  167.     }
  168.     # Listes des binds.
  169.     bind msg - "auth" [namespace current]::auth
  170.     bind msg - "deauth" [namespace current]::deauth
  171.     bind join - "$::gestion::chanlog *" [namespace current]::joindeauth
  172.     bind sign o|o "*" [namespace current]::quitdeauth
  173.     # Désinstallation du Script.
  174.     #if {[info commands ::gestion::uninstall] eq "::gestion::uninstall"} { ::gestion::uninstall }
  175.     #proc uninstall {args} {
  176.         #variable script_name
  177.         #putlog "\0031Désallocation des ressources de\0031 $script_name"
  178.         #foreach binding [lsearch -inline -all -regexp [binds *[set gestion [string range [namespace current] 2 end]]*] " \{?(::)?$gestion"] {
  179.             #unbind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] [lindex $binding 4]
  180.         #}
  181.         #namespace delete [namespace current]
  182.     #}
  183.     putlog "\002Chargement\002 $script_name"
  184. }
Add Comment
Please, Sign In to add comment