########################### ### Fini le tataouinage, les bots se op... # Password pour CService ... set passwdcs "BilibouBob" # No flood X set nfw 0 proc cserviceop { canal } { global passwdcs botnick nfw if !$nfw { putserv "PRIVMSG x@channels.undernet.org :login AideBot $passwdcs" putserv "PRIVMSG x :op $canal $botnick" putlog "Demandé le Op à CService sur $canal" set nfw 1 utimer 20 {set nfw 0} } } proc cserviceinvite { canal } { global passwdcs botnick nfw if !$nfw { putserv "PRIVMSG x@channels.undernet.org :login AideBot $passwdcs" putserv "PRIVMSG x :invite $canal $botnick" putlog "Demandé à CService de m'inviter sur $canal" set nfw 1 utimer 20 {set nfw 0} } } bind bot - op opbot proc opbot { from command chan } { if [botisop $chan] { pushmode $chan +o $from putlog "Donné le Op à $from sur $chan à sa demande" } } bind bot - invite invitebot proc invitebot { from command chan } { if [botisop $chan] { putserv "INVITE $from $canal" putlog "Invité $from sur $chan à sa demande." } } set cserviceoubot "cservice" proc besoinop { canal } { global cserviceoubot if {($cserviceoubot == "cservice") && [handonchan CService $canal]} { cserviceop $canal set cserviceoubot "bot" } else { if {$canal == "#aide"} { putbot Aide "op $canal" } elseif {$canal == "#cours"} { putbot ProfBot "op $canal" } set cserviceoubot "cservice" } } proc besoininvite { canal } { global cserviceoubot if {$cserviceoubot == "cservice"} { cserviceinvite $canal set cserviceoubot "bot" } else { if {$canal == "#aide"} { putbot Aide "invite $canal" } elseif {$canal == "#cours"} { putbot ProfBot "invite $canal" } set cserviceoubot "cservice" } } ################################### ### Jupe utimer 5 besoinjupe proc besoinjupe {} { global botnick okijupe if [string match *besoinjupe* [utimers]] {return 0} utimer 5 besoinjupe if {($botnick != "AideBot") & ([onchan $botnick #aide])} { putserv "nick AideBot" } else { catch [putbot JupeAide "nojupe"] set okijupe 0 } } set okijupe 0 bind join b * joinbotjupe proc joinbotjupe {nick host hand chan} { global okijupe if {($hand == "Aide") & ($nick != "Aide")} { set okijupe [utimer 1 stopjupe] } } bind mode b * modebotjupe proc modebotjupe {nick host hand chan mode victim} { global okijupe if {([nick2hand $victim] == "Aide") & ($victim != "Aide") & ([string tolower $chan] == "#aide") & ($mode == "+o")} { set okijupe [utimer 1 stopjupe] } } proc stopjupe {} { global okijupe if [string match *stopjupe* [utimers]] {return 0} if $okijupe { utimer 1 stopjupe putbot JupeAide "stopjupe Aide" } } #################################### # Permet aux ops de se opper via Aide ou de le faire jumper bind filt p .jump* filtjump proc filtjump {idx text} { global servers set commande [string tolower [lindex $text 0]] set serveur [lindex $text 1] if {$serveur == "?"} { if {$commande == ".jump"} { putdcc $idx "Dernière personne ayant utilisé le jump (AideBot): [getuser AideBot xtra jump]" return "" } if {$commande == ".jump-aide"} { putdcc $idx "Dernière personne ayant utilisé le jump (Aide): [getuser Aide xtra jump]" return "" } } else { set port [lindex $text 2] set len [string length $serveur] set len [expr $len - 1] if {[string index $serveur $len] == "*"} { set len [expr $len - 1] set serveur [string range $serveur 0 $len] set serveur [lindex [split [lindex $servers [lsearch -regexp [string tolower $servers] [string tolower $serveur]]] :] 0] } if {$commande == ".jump"} { setuser AideBot xtra jump "[getuser [idx2hand $idx] xtra vrainick] à [time] le [date]" } if {$commande == ".jump-aide"} { setuser Aide xtra jump "[getuser [idx2hand $idx] xtra vrainick] à [time] le [date]" } return "$commande $serveur $port" } } bind dcc O jump-aide jump_aide proc jump_aide {hand idx args} { set args [lindex $args 0] set serveur [lindex $args 0] set port [lindex $args 1] if {$serveur == ""} {set serveur "irc.undernet.org"} if {$port == ""} {set port "6667"} if [string match *.undernet.org [string tolower $serveur]] { putbot Aide "jump $serveur $port" putdcc $idx "Oki, j'ai demandé à Aide de changer de serveur" return 1 } else { putdcc $idx "Hum, ce n'est pas un serveur Undernet ça !" return 0 } } bind bot - log bot_log proc bot_log { from commande args } { set args [lindex $args 0] putlog "$from : $args" } bind dcc O op-aide op_aide proc op_aide {hand idx args} { set args [lindex [lindex $args 0] 0] if {$args == ""} { putdcc $idx "Qui veux-tu que Aide op?" return 0 } putbot Aide "opop $args" putdcc $idx "Oki, j'ai demandé à Aide de opper $args sur #Aide" return 1 } ################################### # Quand X kick AideBot, Aide envoie unban et unsuspend. bind kick - "#aide AideBot*" kickbyx proc kickbyx {nick host hand chan target reason} { global botnick if {($hand != "CService") | ($botnick != $target)} { return 0 } putbot Aide "msg X unban #Aide $botnick" putbot Aide "msg X unsuspend #Aide AideBot" }