Voici un petit script qui peut fonctionner :
Par contre, il n'agit que lorsqu'il y a un départ du canal, mais le principe est là. Il faut que les nicks des eggdrops et les botnet-nicks soient pareils.
Par contre, il n'agit que lorsqu'il y a un départ du canal, mais le principe est là. Il faut que les nicks des eggdrops et les botnet-nicks soient pareils.
tcl
namespace eval joiner {
# Nom de l'eggdrop hub
variable hub "toto"
# Canal "pool"
variable pool "#eggdrops"
# Canal à nombre d'eggdrops fixe
variable target "#target"
# Nombre d'eggdrops
variable nbb 6
bind part - "$::joiner::target *" ::joiner::partchan
bind sign - "$::joiner::target *" ::joiner::partchan
proc partchan {nick uhost handle chan {msg ""}} {
if { [string tolower $::botnick] != [string tolower $::joiner::hub] } { return 0; }
set nb [llength [chanlist $chan]]
if { $nb < $::joiner::nbb } {
::joiner::invite [expr $::joiner::nbb - $nb]
}
return 0
}
proc invite { nb } {
set pres [chanlist $::joiner::target]
set pot [chanlist $::joiner::pool]
foreach drop [split $pres] {
set e [lsearch $pot $drop]
set pot [lreplace $pot $e $e]
}
set inv 0
while {$inv < $nb } {
set bot [lindex $pot [rand [llength $pot]]]
set e [lsearch $pot $bot]
set pot [lreplace $pot $e $e]
putbot $bot ">come"
incr inv
}
return 0
}
bind bot - ">come" ::joiner::come
proc come {frm_bot command arg} {
if { [string tolower $frm_bot] != [string tolower $::joiner::hub] } { return 0; }
channel add $::joiner::target
}
bind evnt - "init-server" ::joiner::init_server
proc init_server {$type} {
if {[string tolower $::botnick] == [string tolower $::joiner::hub]} { return 0;}
if {[lsearch [channels] $::joiner::target]} {
channel remove $::joiner::target
}
}
}