#--------------------------------------------------------------------- # noprivate.tcl # TCL script for IRC-bot eggdrop # Bot will kick a nick if nick private messages the bot. # Number of kicks is limited (in case bot and offender are both on # many -and the same- channels). # v0: 19-Feb-2002 # v1: 20-Feb-2002 # v2: 25-Feb-2002 # - bot may not kick itself #--------------------------------------------------------------------- bind msgm - * noprivate #--------------------------------------------------------------------- # Initialize #--------------------------------------------------------------------- set noprivtimestamp 0 #--------------------------------------------------------------------- # proc noprivate #--------------------------------------------------------------------- proc noprivate { nick uhost hand text } { global botnick global noprivtimestamp # ignore known users if {[string compare $hand "*"] != 0 } { return 0 } # bot msged itself if {[string compare $nick $botnick] == 0 } { return 0 } # check timestamp of last kick against currenttime set currenttime [unixtime] if {[expr $currenttime - $noprivtimestamp] < 10} { return 1 } # initialize kickcount set kickcount 0 # iterate all channels, abort if too many kicks. foreach channel [channels] { # sanity checks if {![validchan $channel]} { continue } if {![botisop $channel]} { continue } if {![onchan $nick $channel]} { continue } # kick putserv "KICK $channel $nick :No private message please" # increment count and abort if too many kicks incr kickcount if {$kickcount >= 3} { break } } # any kicks? reset timestamp to currenttime if {$kickcount > 0} { set noprivtimestamp $currenttime } putlog "NOPRIVATE: kicked $nick $kickcount time(s)" return 1 } putlog "Noprivate version 2 loaded."