proc pot:liste { chan } {
set fichier "./scripts/pot/liste.txt"
if {![file exists $fichier]} {
putserv "privmsg $chan \002\Il n'y a aucun \0033potentiel \0031actuellement"
return 0
}
set infile [open $fichier r]
set tampon [read -nonewline $infile]
close $infile
set tampon [split $tampon "\n"]
if {![llength $tampon]} {
putserv "privmsg $chan \002\Il n'y a aucun \0033potentiel \0031actuellement"
return 0
}
set nbPots [llength $tampon]
set potList ""
foreach pot $tampon {
set nbNotes [getnbnotes $pot]
if {$nbNotes == -1} { set nbNotes "inconnu" }
append potList "$pot ($nbNotes), "
}
putserv "privmsg $chan Liste des \002\037\00310Potentiels\037\002 ( $nbPots ) :\002\0033 $potList"
return 1
}
proc getnbnotes {pseudo} {
# Ton code pour récup le nombre de notes
# Si toutes tes conditions sont bonnes, tu retournes le nombre de notes
return $nbNotes
# Sinon, tu retournes 0...
return -1
}