# ChanStats v1.0 # Neon's Web (http://www.eggdrop.online.fr) # by Neon (chris.neon@bigfoot.com) ##################################################################### ## Configuration du Script ########################################## ##################################################################### # Chemin et nom du fichier html pour chaque channel (sans l'extension) : set irc2htmlfile(#agumon) "index1" # Extension utilisée : set irc2html(ext) "htm" # Rafraichissement du navigateur web (en minutes) : set irc2html(refresh) 25 # Channels dont la discussion sera retranscrise : set irc2html(chans) "#agumon" # Maximum de lignes en mémoire pour la retranscription : set irc2html(maxlines) 20 ##################################################################### ##################################################################### ##################################################################### set irc2html(version) "1.0" set color(0) "#FFFFFF" set color(1) "#000000" set color(2) "#00007F" set color(3) "#008F00" set color(4) "#FF0000" set color(5) "#7F0000" set color(6) "#9F009F" set color(7) "#FF7F00" set color(8) "#F0FF00" set color(9) "#00F700" set color(10) "#008F8F" set color(11) "#00F7FF" set color(12) "#0000FF" set color(13) "#FF00FF" set color(14) "#7F7F7F" set color(15) "#CFCFCF" if {$irc2html(chans) != ""} { foreach channel $irc2html(chans) { set irc2htmldata($channel) [list] } } proc stats:irc2html {} { global irc2html irc2htmlfile foreach channel [array names irc2htmlfile] { if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} { putlog "ChanStats : Je ne suis pas sur $channel." unset irc2htmlfile($channel) } if ![string match "*stats:irc2html*" [timers]] { timer $irc2html(refresh) stats:irc2html } stats:irc2html:make $channel } return 1 } proc stats:irc2html:make {channel} { global irc2html irc2htmldata server irc2htmlfile timezone version botnick color set channel [string tolower $channel] set incr(op) 0 set incr(voice) 0 set incr(normal) 0 set incr(total) 0 set nicks(op) "" set nicks(voice) "" set nicks(normal) "" foreach nick [chanlist $channel] { incr incr(total) 1 if [isop $nick $channel] { lappend nicks(op) $nick incr incr(op) 1 } elseif [isvoice $nick $channel] { lappend nicks(voice) $nick incr incr(voice) 1 } else { lappend nicks(normal) $nick incr incr(normal) 1 } } set users "$nicks(op) $nicks(voice) $nicks(normal)" set out [open $irc2htmlfile($channel).$irc2html(ext) w] puts $out "
Server: [lindex [split $server :] 0] (port [lindex [split $server :] 1])" puts $out "Topic : [topic $channel]" puts $out "Modes : [getchanmode $channel]" puts $out "Users : $incr(total) au total." puts $out "
Nickname | " puts $out "User@Host" puts $out " | Inactif" puts $out " |
@$user | " puts $out "[getchanhost $user $channel] | " puts $out "[getchanidle $user $channel] min | " puts $out "
+$user | " puts $out "[getchanhost $user $channel] | " puts $out "[getchanidle $user $channel] min | " puts $out "
$user | " puts $out "[getchanhost $user $channel] | " puts $out "[getchanidle $user $channel] min | " puts $out "
$incr(op) opers | " puts $out "([expr [expr $incr(op) * 100.0] / $incr(total)] %) | " puts $out "![]() |
$incr(voice) voices | " puts $out "([expr [expr $incr(voice) * 100.0] / $incr(total)] %) | " puts $out "![]() |
$incr(normal) normal | " puts $out "([expr [expr $incr(normal) * 100.0] / $incr(total)] %) | " puts $out "![]() |
Mask bannis de $channel | " puts $out "Mis par" puts $out " | Depuis" puts $out " |
[lindex $ban 0] | " puts $out "[lindex [split [lindex $ban 1] !] 0] | " puts $out "[lindex $ban 2] sec | " puts $out "
Mask exempts de $channel | " puts $out "Mis par" puts $out " | Depuis" puts $out " |
[lindex $exempt 0] | " puts $out "[lindex [split [lindex $exempt 1] !] 0] | " puts $out "[lindex $exempt 2] sec | " puts $out "
Mask invités de $channel | " puts $out "Mis par" puts $out " | Depuis" puts $out " |
[lindex $invited 0] | " puts $out "[lindex [split [lindex $invited 1] !] 0] | " puts $out "[lindex $invited 2] sec | " puts $out "
" for {set i 0} {$i < [llength $irc2htmldata($channel)]} { incr i } { puts $out "[lindex $irc2htmldata($channel) $i]" } puts $out "" } puts $out "
Généré avec ChanStats v$irc2html(version) ($botnick eggdrop [lindex $version 0])." puts $out "Mise à jour toutes les $irc2html(refresh) minute(s)." puts $out "" close $out return 1 } bind ctcp -|- ACTION stats:irc2html:ctcp bind join -|- * stats:irc2html:join bind kick -|- * stats:irc2html:kick bind mode -|- * stats:irc2html:modefixed bind nick -|- * stats:irc2html:nick bind part -|- * stats:irc2html:part bind pubm -|- * stats:irc2html:pubm bind sign -|- * stats:irc2html:sign bind topc -|- * stats:irc2html:topc proc stats:irc2html:ctcp {nick uhost hand dest keyword arg} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $dest]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($dest) [lappend irc2htmldata($dest) "\[[time]\] * $nick $arg"] stats:irc2html:make $dest } } proc stats:irc2html:join {nick uhost hand channel} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick ($uhost) has joined $channel"] stats:irc2html:make $channel } } proc stats:irc2html:kick {nick uhost hand channel knick arg} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $knick was kicked by $nick ($arg)"] stats:irc2html:make $channel } } proc stats:irc2html:mode {nick uhost hand channel mode} { global irc2html irc2htmldata server color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { if {$nick == ""} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** [lindex [split $server :] 0] sets mode: $mode"] } else { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick sets mode: $mode"] } stats:irc2html:make $channel } } proc stats:irc2html:modefixed {nick uhost hand channel mode {victim ""}} { global irc2html irc2htmldata if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { if {$victim != ""} { append mode " $victim" } stats:irc2html:mode $nick $uhost $hand $channel $mode } } proc stats:irc2html:nick {nick uhost hand channel newnick} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick is now known as $newnick"] stats:irc2html:make $channel } } proc stats:irc2html:part {nick uhost hand channel} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick ($uhost) has left $channel"] stats:irc2html:make $channel } } proc stats:irc2html:pubm {nick uhost hand channel arg} { global irc2html irc2htmldata server color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { if {$nick == ""} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] <\;[lindex [split $server :] 0]>\; \;$arg"] } else { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] <\;$nick>\; \;$arg"] } stats:irc2html:make $channel } } proc stats:irc2html:sign {nick uhost hand channel arg} { global irc2html irc2htmldata color if {([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick ($uhost) has quit irc ($arg)"] stats:irc2html:make $channel } } proc stats:irc2html:topc {nick uhost hand channel topic} { global irc2html irc2htmldata server color if {(([lsearch -exact [string tolower $irc2html(chans)] [string tolower $channel]] != -1) || ($irc2html(chans) == "*")) && ($nick != "*")} { if {$nick == ""} { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** [lindex [split $server :] 0] changes topic to '$topic'"] } else { set irc2htmldata($channel) [lappend irc2htmldata($channel) "\[[time]\] *** $nick changes topic to '$topic'"] } stats:irc2html:make $channel } } proc irc2html:time {last} { set ans 0 set jours 0 set heures 0 set mins 0 set time [expr [unixtime] - $last] if {$time < 60} {return "$time sec"} if {$time >= 31536000} { set ans [expr int([expr $time/31536000])] set time [expr $time - [expr 31536000*$ans]] } if {$time >= 86400} { set jours [expr int([expr $time/86400])] set time [expr $time - [expr 86400*$jours]] } if {$time >= 3600} { set heures [expr int([expr $time/3600])] set time [expr $time - [expr 3600*$heures]] } if {$time >= 60} {set mins [expr int([expr $time/60])]} if {$ans == 0} {set output ""} elseif {$ans == 1} {set output "1 an,"} {set output "$ans ans,"} if {$jours == 1} {lappend output "1 jour,"} elseif {$jours > 1} {lappend output "$jours jours,"} if {$heures == 1} {lappend output "1 heure,"} elseif {$heures > 1} {lappend output "$heures heures,"} if {$mins == 1} {lappend output "1 minute"} elseif {$mins > 1} {lappend output "$mins minutes"} return [string trimright [join $output] ", "] } timer $irc2html(refresh) stats:irc2html putlog "ChanStats v1.0"