Guest User

Untitled

a guest
Dec 12th, 2018
116
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.  
  62.     variable chanlog
  63.     variable port
  64.     set arg [gbfilter $arg]
  65.     set args [split $arg]
  66.     if {[llength $args] != 2} {
  67.         putserv "notice $nick :[::msgcat::mc ErrorAuth $::botnick]"
  68.         return 0
  69.     }
  70.     set pseudo [lindex $args 0]
  71.     set chan [lindex $args 2]
  72.     set pass [lindex $args 1]
  73.     if {[nick2hand $pseudo] eq "*"} {
  74.         putserv "notice $nick :[::msgcat::mc NoAxx $nick]"
  75.         retrun 0
  76.     }
  77.     if {![passwdok $pseudo $pass]} {
  78.         putserv "notice $nick :[::msgcat::mc ErrorPass]"
  79.         return 0
  80.     }
  81.     if {![string match -nocase [lindex [getuser $pseudo HOSTS] 0] "$nick!$host"]} {
  82.         putserv "notice $nick :[::msgcat::mc ErrorHost]"
  83.         return 0
  84.     }
  85.     if {[getuser $pseudo XTRA AUTH] eq "ON"} {
  86.         putserv "notice $nick :[::msgcat::mc ErrorDejaAuth]"
  87.         return 0
  88.     }
  89.     if {[getuser $hand XTRA SUSPEND] eq "ON"} {
  90.         putserv "notice $nick :[::msgcat::mc SuspendOn $nick]"
  91.         return 0
  92.     }
  93.     puthelp "notice $nick :[::msgcat::mc Auth $nick]"
  94.     puthelp "privmsg $chanlog :[::msgcat::mc AuthLog $hand]"
  95.     puthelp "privmsg $chanlog :[::msgcat::mc ChanLog] [::msgcat::mc AxxPl $nick]"
  96.     setuser $pseudo XTRA AUTH ON;
  97.     setuser $hand XTRA SEEN [clock format [clock seconds] -format "le %d/%m/%Y à %Hh%M"]
  98.     #chattr $hand +p
  99.     save
  100.     #listen $port users
  101.     puthelp "privmsg $nick :\001DCC CHAT chat [myip] $port\001"
  102.     return
  103.     }
  104.     # Procédure déauthentification.
  105.     proc deauth { nick host hand arg } {
  106.         variable chanlog
  107.         set arg [gbfilter $arg]
  108.         set args [split $arg]
  109.         set pseudo [lindex $arg 0]
  110.         set pass [lindex $args 1]
  111.         if {[llength $args] != 2} {
  112.             putserv "notice $nick :[::msgcat::mc ErrorDeauth $::botnick]"
  113.             return 0
  114.         }
  115.         if {[nick2hand $pseudo] eq "*"} {
  116.             putserv "notice $nick :[::msgcat::mc NoAxx $nick]"
  117.             return 0
  118.         }
  119.         if {![passwdok $pseudo $pass]} {
  120.             putserv "notice $nick :[::msgcat::mc ErrorPass]"
  121.             return 0
  122.         }
  123.         if {[getuser $hand XTRA auth] eq "ON"} {
  124.             putserv "notice $nick :[::msgcat::mc AuthOff $nick]"
  125.             putserv "privmsg $chanlog :[::msgcat::mc DeauthLog $hand]"
  126.             setuser $pseudo XTRA AUTH OFF;
  127.             #chattr $hand -p
  128.             save
  129.             #boot $hand "Vous êtes déauthentifié,vous ne pouvez rester en Party-Line."
  130.             return
  131.         }
  132.     }
  133.        
  134.     # Procédure Filter.
  135.     proc gbfilter {x {y ""} } {
  136.         for {set i 0} {$i < [string length $x]} {incr i} {
  137.             switch -- [string index $x $i] {
  138.                 "\"" {append y "\\\""}
  139.                 "\\" {append y "\\\\"}
  140.                 "\[" {append y "\\\["}
  141.                 "\]" {append y "\\\]"}
  142.                 "\} " {append y "\\\} "}
  143.                 "\{" {append y "\\\{"}
  144.                 default {append y [string index $x $i]}
  145.             }
  146.         }
  147.         return $y
  148.     }
  149.     # Procédure réinitialisation des accès du Bot.
  150.     proc joindeauth {nick host hand chan} {
  151.         variable chanlog
  152.         if {$nick=="$::botnick"} {
  153.             putserv "privmsg $chanlog :[::msgcat::mc DeauthJoin]"
  154.             putserv "privmsg $chanlog :[::msgcat::mc DeauthJoin2]"
  155.             foreach user [userlist * $chan] {
  156.                 setuser $user XTRA AUTH OFF
  157.                 #boot $user "Vous êtes déauthentifié,vous ne pouvez rester en Party-Line."
  158.             }
  159.         }
  160.     }
  161.     # Déauthentification au quit d'une personnes ayant un accès.
  162.     proc quitdeauth { nick uhost hand chan {msg ""}} {
  163.         variable chanlog
  164.         if {[matchattr $hand o|o $chan] && [isauth $hand]} {
  165.             setuser $hand XTRA AUTH OFF
  166.             putserv "privmsg $chanlog :[::msgcat::mc DeauthQuit $hand]"
  167.         }
  168.     }
  169.     # Listes des binds.
  170.     bind msg - "auth" [namespace current]::auth
  171.     bind msg - "deauth" [namespace current]::deauth
  172.     bind join - "$::gestion::chanlog *" [namespace current]::joindeauth
  173.     bind sign o|o "*" [namespace current]::quitdeauth
  174.     # Désinstallation du Script.
  175.     #if {[info commands ::gestion::uninstall] eq "::gestion::uninstall"} { ::gestion::uninstall }
  176.     #proc uninstall {args} {
  177.         #variable script_name
  178.         #putlog "\0031Désallocation des ressources de\0031 $script_name"
  179.         #foreach binding [lsearch -inline -all -regexp [binds *[set gestion [string range [namespace current] 2 end]]*] " \{?(::)?$gestion"] {
  180.             #unbind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] [lindex $binding 4]
  181.         #}
  182.         #namespace delete [namespace current]
  183.     #}
  184.     putlog "\002Chargement\002 $script_name"
  185. }
Add Comment
Please, Sign In to add comment