rendered paste bodyproc pReadFile {} {
if {[file exists kcount.txt]} {
set id [open kcount.txt r]
gets $id kickcount
if {![string is integer -strict $kickcount]} {
set kickcount 0
}
close $id
} else {
set kickcount 0
}
return $kickcount
}
proc pWriteFile {kickcount} {
set id [open kcount.txt w]
puts $id $kickcount
close $id
}
bind KICK - * pKickCounter
proc pKickCounter {nick uhost hand chan target reason} {
if {[isbotnick $nick]} {
set kickcount [pReadFile]
incr kickcount
pWriteFile $kickcount
putserv "PRIVMSG $chan :Kick number #$kickcount"
}
}