########################################### # La version !!! set aidebot "6.4.20021007" bind dcc p version dcc_version proc dcc_version {hand idx arg} { global aidebot putdcc $idx "AideBot version $aidebot" return 1 } ########################################### #Associations... assoc 1 Membres assoc 9 MonLit assoc 10 Bureau assoc 20 Bureau-Canal assoc 30 Bureau-Projets assoc 75 Adjoints assoc 150 Ops assoc 250 Parrains assoc 500 Admins assoc 510 Admins-Généraux assoc 520 Admins-Canal assoc 530 Admins-Projets assoc 1000 Cours assoc 1111 IA assoc 1234 Enfer assoc 2000 IGT assoc 3000 Devoirs&Lecons ############################## # .bureau bind dcc p bureau dcc_bureau proc dcc_bureau {hand idx arg} { dccsimul $idx ".chat 10" } ############################## # .barre / .debarre set canauxbarres "" set canauxproteges "1 9 10 20 30 75 150 250 500 510 520 530 1000 1234 1111 2000 3000" set canauxbloques "9 10 1234 1111 2000" set canauxprives "250 500 510 520 530" bind dcc p barre dcc_barre proc dcc_barre {hand idx arg} { global canauxbarres canauxproteges set canal [getchan $idx] set arg [lindex $arg 0] if {[matchattr $hand A] & [estunnombre:ok $arg]} { if {($arg < 200000) & ($arg > -1)} { set canal $arg } } if {$canal == 0} { putdcc $idx "Pfff! Tu ne peux pas barrer le partyline!" return 0 } elseif {$canal == -1} { putdcc $idx "C'est ça c'est ça... t'es déjà tout seul et en plus tu veux t'enbarrer... Prends ta pilule, ça va aller mieux ..." return 0 } elseif {([lsearch -exact $canauxproteges $canal] != -1) & ![matchattr $hand A]} { putdcc $idx "Tu n'as pas l'autorisation de barrer ce canal ..." return 0 } elseif {[lsearch -exact $canauxbarres $canal] != -1} { putdcc $idx "Le canal est déjà barré ..." return 0 } else { lappend canauxbarres $canal dccputchan $canal "$hand vient de barrer le canal ***" if {$canal != [getchan $idx]} { putdcc $idx "Oki, vous avez barré le canal $canal." } return 1 } } bind dcc p debarre dcc_debarre bind dcc p débarre dcc_debarre proc dcc_debarre {hand idx arg} { global canauxbarres canauxproteges set canal [getchan $idx] set arg [lindex $arg 0] if {[matchattr $hand A] & [estunnombre:ok $arg]} { if {($arg < 200000) & ($arg > -1)} { set canal $arg } } set ou [lsearch -exact $canauxbarres $canal] if {$ou == -1} { putdcc $idx "Ben, c'est pas barré ici !" return 0 } elseif {([lsearch -exact $canauxproteges $canal] != -1) & ![matchattr $hand A]} { putdcc $idx "Tu n'as pas l'autorisation de débarrer ce canal ..." return 0 } else { set canauxbarres [lreplace $canauxbarres $ou $ou] dccputchan $canal "$hand vient de débarrer le canal ***" if {$canal != [getchan $idx]} { putdcc $idx "Oki, vous avez débarré le canal $canal." } return 1 } } bind filt p .chat* chatsurbot proc chatsurbot {idx text} { global canauxbarres canauxprives if {[string tolower [lindex $text 0]] != ".chat"} { return $text } if [matchattr [idx2hand $idx] D] { set idxenfer $idx utimer 1 {rameneenenfer $idxenfer} return "" } utimer 1 timer_test_enfer set canal [lindex $text 1] if {($canal == "")||([string tolower $canal] == "on")||([string tolower $canal] == "off")||([string index $canal 0] == "*")} { return $text } if {([string first [string range $canal 0 0] "0123456789"] == -1)||([string first [string range $canal end end] "0123456789"] == -1)} { set canal [assoc $canal] } if {($canal == "") | ($canal > 199999) | ($canal < 0)} { putdcc $idx "Ce canal n'existe pas!" return "" } set ou [lsearch -exact $canauxbarres $canal] if {([whom $canal] == "") & ($ou != -1)} { set canauxbarres [lreplace $canauxbarres $ou $ou] return $text } if {($canal == 250) & [matchattr [idx2hand $idx] AE]} { return $text } if {([lsearch -exact $canauxprives $canal] != -1) & ![matchattr [idx2hand $idx] A]} { putdcc $idx "*** Ce canal est privé. ***" return "" } if {[lsearch -exact $canauxbarres $canal] != -1} { dccputchan $canal "[idx2hand $idx] essaie de rentrer sur le canal, mais celui-ci est barré. ***" putdcc $idx "*** Le canal est barré. Les membres se trouvant sur le canal ont été avertis que tu voulais y entrer. Essaie un peu plus tard. ***" return "" } return $text } ### # .who -> .whom * bind filt p .who whowhom proc whowhom {idx text} { if ![matchattr [idx2hand $idx] A] { return ".whom *" } else { return $text } } ########################################### #echo off + remet le bon nick! bind chon p * ajustements proc ajustements { hand idx } { if [matchattr $hand S] { chattr $nick -px killdcc $idx return 0 } foreach user [dcclist chat] { if {([lindex $user 1] == $hand) && ([lindex $user 0] != $idx)} { putdcc [lindex $user 0] "Clone !? Na, un seul acccès suffit sur AideBot !!! :-)" dccputchan [getchan [lindex $user 0]] "[lindex $user 1] a été expulsé: Clone ou fantôme ! ***" putlog "Exclusion d'un clone de [lindex $user 1]" set nick [getuser [lindex $user 1] xtra vrainick] if {($nick != [lindex $user 1])} { chnick [lindex $user 1] $nick } killdcc [lindex $user 0] } } check_arrivee_back $hand $idx } bind chof - * quitte_bot proc quitte_bot { hand idx } { set nick [getuser $hand xtra vrainick] if {($nick != $hand)} { chnick $hand $nick } } bind away - * away_bot proc away_bot {bot idx text} { if {$text == ""} { check_arrivee_back [idx2hand $idx] $idx } } proc check_arrivee_back {hand idx} { # Avertir un admin? # if [matchattr $hand L] { set oki 0 foreach adm [userlist A] { if {[lsearch [string tolower [lrange [getuser $hand xtra avertir] 2 end]] [string tolower [getuser $adm xtra vrainick]]] != -1} { set oki 1 lappend adms $adm } } if $oki { if {([lsearch [string tolower $adms] [string tolower [lindex [getuser $hand xtra avertir] 1]]] == -1) & [validuser [lindex [getuser $hand xtra avertir] 1]]} { lappend adms [lindex [getuser $hand xtra avertir] 1] } foreach adm $adms { putdcc "\[[time]\]  AVERTIR:  [lindex [getuser $hand xtra avertir] 1] (le [dire_date [lindex [getuser $hand xtra avertir] 0]]) a noté ceci sur $hand\ (bot): [lrange [getuser $hand xtra avertir] 2 end]" } } else { putlog " AVERTIR:  [lindex [getuser $hand xtra avertir] 1] (le [dire_date [lindex [getuser $hand xtra avertir] 0]]) a noté ceci sur $hand\ (bot): [lrange [getuser $hand xtra avertir] 2 end]" } } # Des news ? # news_check $idx "dcc" $hand "&general" 0 if [matchattr $hand OJ|of #aide] { news_check $idx "dcc" $hand "#aide" 0 } if [matchattr $hand -|of #cours] { news_check $idx "dcc" $hand "#cours" 0 } if [matchattr $hand TRP] { news_check $idx "dcc" $hand "&projets" 0 } if [matchattr $hand A] { news_check $idx "dcc" $hand "#aidebot" 0 } # Ajuster la console? # if ![matchattr $hand O] { console $idx #Aide -12345678 } if ![matchattr $hand A] { console $idx #Aide -cox } # Des votes ? # doisjevoter $hand $idx # Des projets à discuter ? # foreach projet [getuser $hand xtra ETATprojet] { set d [lindex $projet 1] if {$d == ""} { set d 2000000000 } if {[unixtime] > $d} { putdcc $idx "11,1 N'OUBLIE PAS  que tu dois rencontrer l'admin qui supervise ton projet au plus tôt! Votre rencontre est due!!!" } } # Un mémo ? # if {[getuser $hand xtra memo] != ""} { putdcc $idx "4MÉMO: [getuser $hand xtra memo]" } # Enfer ? # utimer 1 timer_test_enfer } ########################################### # Associe au .note le XTRA absence + Vérifie si +p # Ajoute aussi la commande '+' bind filt - .note* absencenote proc absencenote {idx texte} { regsub -all {\}|\{|\]|\[|\\} $texte "" texte regsub -all {\"} $texte "¨" texte set text [string tolower $texte] set hand [idx2hand $idx] if {([string tolower $hand] != [string tolower [getuser $hand xtra vrainick]]) & ([lindex $text 0] == ".note")} { set texte "$texte (-[getuser $hand xtra vrainick])" } if {[lindex $text 0] == ".note"} { if ![validuser [lindex $text 1]] { set qui "" foreach user [whom *] { if {[lindex $text 1] == [string tolower [getuser [lindex $user 0] xtra vrainick]]} { set qui [lindex $user 0] } } if {$qui == ""} { return $texte } putdcc $idx "Pssst: [lindex $texte 1] porte actuellement le nom de $qui\, je lui transmets la note ..." setuser $hand xtra dernierenote $qui setuser $qui xtra dernierenoterecue $hand return "[lindex $texte 0] $qui [lrange $texte 2 end]" } if {[notes [lindex $text 1]] > 90} { dcc_mailnotes [lindex $text 1] "-1" "" erasenotes [lindex $text 1] "1-90" } if {[lindex $text 1] == "aidebot"} { noteaidebot $idx [lrange $texte 2 end] return "" } if [matchattr [lindex $text 1] pS] { set absence [getuser [lindex $text 1] XTRA absence] setuser $hand xtra dernierenote [lindex $text 1] setuser [lindex $text 1] xtra dernierenoterecue $hand if {$absence != ""} { putdcc $idx "À noter: $absence" } return $texte } else { putdcc $idx "Vous ne pouvez laisser de note à cet usager." return "" } } else { return $texte } } bind filt - &* notesuivante proc notesuivante {idx texte} { absencenote $idx ".note [getuser [idx2hand $idx] xtra dernierenote] & [string range $texte 1 end]" } bind filt - ¦* notesuivanterecue proc notesuivanterecue {idx texte} { absencenote $idx ".note [getuser [idx2hand $idx] xtra dernierenoterecue] ¦ [string range $texte 1 end]" } ########################################### set ctcp-version "AideBot version $aidebot - Le bot d'#Aide" set ctcp-finger "Vous me trouverez toujours sur #Aide et #Cours" set ctcp-userinfo "Dédié à toute l'équipe de #Aide !" set ctcp-clientinfo "Créé par Alocin !" ########################################## ### La virgule ... bind filt p ,* virgule proc virgule {idx text} { set text [string range $text 1 end] foreach user [whom *] { set hand [lindex $user 0] if {[matchattr $hand A] && ($hand != [idx2hand $idx])} { putdcc [hand2idx $hand] "-[idx2hand $idx]=> $text" } } } ########################################## ### L'accent grave ... bind filt AH `* accentgrave proc accentgrave {idx text} { set text [string range $text 1 end] foreach user [whom *] { set hand [lindex $user 0] if {[matchattr $hand AH] && ($hand != [idx2hand $idx])} { putdcc [hand2idx $hand] "`[idx2hand $idx]`> $text" } } } ############################################# ### Changement de nick ... bind filt p .nick* nicksurbot proc nicksurbot {idx text} { set text [string range $text 0 14] regsub -all {\"|\}|\{|\]|\[|\\|\&|\||\*|\$|\(|\)|\<|\>|\#|\/} $text "" text set ok 1 if {([string tolower $text] == ".nick") | ([string tolower $text] == ".handle")} { return $text } foreach user [dcclist] { if [validuser [lindex $user 1]] { if {($idx != [lindex $user 0])&&([string tolower [getuser [lindex $user 1] xtra vrainick]] == [string tolower [lindex $text 1]])} { set ok 0 } } } if {$ok == 1} { return $text } else { putdcc $idx "Cet alias appartient à un autre membre." } } ################################################### # Commandes désactivées ... bind dcc - voice aux_poubelles bind dcc - devoice aux_poubelles bind dcc - noteign aux_poubelles bind dcc - +noteign aux_poubelles bind dcc - jump-aide- aux_poubelles bind dcc - nick- aux_poubelles bind dcc - handle aux_poubelles proc aux_poubelles {hand idx arg} { putdcc $idx "Quoi ? Utilisez '.help'" return 0 } ################################################### # Accès des +A bind dcc p console dcc_console proc dcc_console {hand idx args} { set args [lrange [lindex $args 0] 0 2] set cible $hand set canal "#Aide" set modesfin "" if {$args == ""} { set canal [lindex [console [hand2idx $cible]] 0] set modesfin [lindex [console [hand2idx $cible]] 1] } elseif [matchattr $hand A] { if [valididx [hand2idx [lindex $args 0]]] { set cible [lindex $args 0] set args [lrange $args 1 end] } elseif [validuser [lindex $args 0]] { putdcc $idx "Vous ne pouvez accéder à la console de quelqu'un absent du bot." return 0 } } if {$args == ""} { set canal [lindex [console [hand2idx $cible]] 0] set modesfin [lindex [console [hand2idx $cible]] 1] } elseif {[matchattr $cible -|o [lindex $args 0]] || ([matchattr $hand A] && [string match *[lindex $args 0]* [channels]])} { set canal [lindex $args 0] set args [lrange $args 1 end] } if {$args == ""} { set modesfin [lindex [console [hand2idx $cible]] 1] } elseif [matchattr $hand A] { set modes $args if ![matchattr $hand n] { set modesfin "" for {set i 0} {$i < [string length $modes]} {incr i} { set char [string index $modes $i] if [string match *$char* "+-mpkjbcox0123456789"] { append modesfin $char } } } else { set modesfin $modes } } if {$cible != $hand} { putdcc $idx "Modes console de $cible: \[[console [hand2idx $cible] $canal $modesfin]\]" } else { putdcc $idx "Oki, modes console actuels: \[[console $idx $canal $modesfin]\]" } return 1 } bind dcc A match *dcc:match bind dcc A chpass *dcc:chpass bind dcc A ignores *dcc:ignores bind dcc A +ignore *dcc:+ignore bind dcc A -ignore *dcc:-ignore bind dcc A -user *dcc:-user bind dcc A save *dcc:save bind dcc A reload *dcc:reload bind dcc A status *dcc:status bind dcc A +host *dcc:+host bind dcc A -host *dcc:-host bind dcc A servers *dcc:servers bind dcc A jump *dcc:jump bind dcc A uptime *dcc:uptime bind dcc A binds *dcc:binds bind dcc A rehelp *dcc:rehelp bind dcc A +lang *dcc:+lang bind dcc A -lang *dcc:-lang bind dcc A who *dcc:who bind dcc A bottree *dcc:bottree bind dcc A trace *dcc:trace bind dcc A su *dcc:su bind dcc A banner *dcc:banner bind dcc A boot *dcc:boot bind dcc A chnick *dcc:chnick bind dcc A rehash *dcc:rehash bind dcc A restart *dcc:restart bind dcc A die *dcc:die bind dcc A msg *dcc:msg bind dcc m privileges dcc_privileges proc dcc_privileges {hand idx arg} { unbind dcc A banner *dcc:banner unbind dcc A boot *dcc:boot unbind dcc A chnick *dcc:chnick unbind dcc A rehash *dcc:rehash unbind dcc A restart *dcc:restart unbind dcc A die *dcc:die unbind dcc A msg *dcc:msg bind dcc m banner *dcc:banner bind dcc m boot *dcc:boot bind dcc m rehash *dcc:rehash bind dcc m restart *dcc:restart bind dcc m die *dcc:die bind dcc m msg *dcc:msg putdcc $idx "Oki, les privilèges ont été retirés aux +A, .rehash pour les rétablir." } bind dcc p aide *dcc:help bind dcc O bots *dcc:bots ####################################### # Easy news... set idxnews 0 bind dcc - nouvelles ttsnouvelles proc ttsnouvelles {hand idx args} { set args [lindex $args 0] if {$args == ""} { set lescanaux [getuser $hand xtra nouvelles] } else { set lescanaux "" foreach canal [string tolower $args] { if {[lsearch [string tolower [channels]] $canal] != -1} { lappend lescanaux $canal } } } if {$lescanaux == ""} { set lescanaux "&general #aide #cours &projets #aidebot" } set liste "" foreach canal $lescanaux { if [news_unread $hand $canal] { news_read $idx dcc $hand $canal "" } else { append liste " $canal" } } if {$liste != ""} { putdcc $idx "Il n'y a pas de nouvelle news ($liste ). '.news read all' pour les archives." } setuser $hand xtra nouvelles $lescanaux return 1 } ###################################### # Boot total ! bind dcc p dehors dcc_dehors proc dcc_dehors {hand idx args} { if {[lindex $args 0] == ""} { putdcc $idx "Voici la liste des gens qui ont un '.dehors' en stock \[[llength [userlist K]]\]: [userlist K]" return 1 } elseif [matchattr $hand K] { set args [lindex $args 0] if {[hand2idx [lindex $args 0]] == -1} { putdcc $idx "Qui ça?" } else { chattr $hand -K boot [lindex $args 0] "(de la part de $hand) [lrange $args 1 end]" set boots [getuser $hand xtra boots] if {$boots == ""} {set boots "0 0"} setuser $hand xtra boots "[expr [lindex $boots 0] + 1] [lindex $boots 1]" set boots [getuser [lindex $args 0] xtra boots] if {$boots == ""} {set boots "0 0"} setuser [lindex $args 0] xtra boots "[lindex $boots 0] [expr [lindex $boots 1] + 1]" return 1 } } else { bootbot $hand boot $hand "Comment ça tu veux mettre [lindex [lindex $args 0] 0] dehors? Y'a que le .meilleur qui a le droit de faire ça! :-)" } } ##################################### ### Echo pour le IA ... set ia_presents "" bind bot - ia bot_ia proc bot_ia {rom command args} { global ia_presents set args [lindex $args 0] foreach user [whom 1111] { putdcc [hand2idx [lindex $user 0]] "IA: <[lindex $args 0]> [lrange $args 1 end]" } if {([lindex $args 1] == "->") & ([lindex $args 0] != "<>")} { putlog "I.A.: [lrange $args 1 end] [lindex $args 0]" if {[lindex $args 2] == "Connexion"} { lappend ia_presents [lindex $args 0] } elseif {[lindex $args 2] == "Déconnexion"} { set ia_presents [lreplace $ia_presents [lsearch -exact $ia_presents [lindex $args 0]] [lsearch -exact $ia_presents [lindex $args 0]]] } } } bind chat - * vers_ia proc vers_ia {hand chan text} { if {$chan == 1111} { putbot Aide "ia $hand $text" } } bind dcc p ia dcc_ia proc dcc_ia {hand idx args} { global ia_presents putdcc $idx "-----------" putdcc $idx "Pour voir les interactions qui ont lieu avec l'I.A. de Aide, utilisez .chat ia" putdcc $idx "À noter que si une phrase est dite dans le .chat ia et qu'elle commence par l'alias d'une des perosnnes présente dans Aide, elle lui sera transmise." putdcc $idx "-----------" putdcc $idx "ÉTAT ACTUEL: \[[llength $ia_presents]\] $ia_presents" putdcc $idx "-----------" return 1 } ##################################### # .où bind dcc p où dcc_ou bind dcc p ou dcc_ou proc dcc_ou {hand idx arg} { global server putdcc $idx "AideBot est sur [lindex [split $server :] 0]" putbot Aide "ou $idx" return 1 } bind bot - retour_ou bot_ou proc bot_ou {from command args} { set args [lindex $args 0] set server [lindex $args 1] set idx [lindex $args 0] putdcc $idx "Aide est sur $server" }