TCL Anti Trout Slap

Anti Trout Slap

# Anti Trout Slap v1.1 By Dude

# Kick method
# 0 = Kick the user who slaps bot
# 1 = Kick the user who slaps anybody
# 2 = Kickban the user who slaps bot
# 3 = Kickban the user who slaps anybody
set troutkickmethod 0

set troutkickreason "Reason here!"

# BAN Time
set troutbantime 120

bind ctcp - ACTION antitrout:ctcp:action

proc antitrout:ctcp:action {nick uhost hand dest keyword arg} {
 global botnick troutkickmethod troutkickreason troutbantime
 if { [validchan $dest] == 1 && ([string tolower [lindex $arg 0]] == "slaps" || [string tolower [lindex $arg 0]] == "slap") && [lsearch [string tolower $arg] trout] >= 2 && [string tolower $nick] != [string tolower $botnick] && [botisop $dest] == 1 } {
  if { $troutkickmethod == 0 && [string tolower [lindex $arg 1]] == [string tolower $botnick] } {
   putserv "kick $dest $nick :$troutkickreason"
  }
  if { $troutkickmethod == 1 } {
   putserv "kick $dest $nick :$troutkickreason"
  }
  if { $troutkickmethod == 2 && [string tolower [lindex $arg 1]] == [string tolower $botnick] } {
   scan [string tolower [getchanhost $nick $dest]] "%\[^@]@%s" host host
   newchanban $dest *!*@$host $botnick "$troutkickreason" $troutbantime
  }
  if { $troutkickmethod == 3 } {
   scan [string tolower [getchanhost $nick $dest]] "%\[^@]@%s" host host
   newchanban $dest *!*@$host $botnick "$troutkickreason" $troutbantime
  }
 }
 return 0
}
putlog "Anti-Slap loaded!"