All pastes #727689 Raw Edit

Stuff

public text v1 · immutable
·published 2007-10-06 08:30 UTC
rendered paste body
proc 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"
  }
}