# anti slaps for fun edited by dirmanto.web.id.
#

# what kick method do you want to use in response to trout slaps?
#
# 0 = kick people who slaps the bot with a trout.
# 1 = kick people who slaps anyone including the bot with a trout.
# 2 = kickban people who slaps the bot with a trout.
# 3 = kickban people who slaps anyone including the bot with a trout.
set troutkickmethod 1

# what kick/kickban reason do you want the bot to use?
set troutkickreason "dilarang tabok tabokan! hihihi.."

# how long do you want bans to last (in minutes) because of trout slapping?
# (NOTE: this only applies if you set kickmethod to 2 or 3)
set troutbantime 30

##### GENERAL SETTINGS ####
# on the old scripts, it's on particular channel. but now, i made it for all channels.
set channel "*"

# Edit the time cycle which is in minutes format depending on the time intervals you want the bot to flow out the advertisment
set time 20

# EDIT the text or REMOVE or ADD lines including inverted commas at the starting and ending at each line 
set text {
  "0,2 15[0JASA15] 0Webhosting & Domain Registration. 11Kepingin Punya Web Sendiri? 0- Hosting, domain dan web desain. Mulai dari 135rb per tahun! 8klik www.dirmanto.com 0atau www.dirmanto.web.id"
  "0,2 15[0INFORMASI15] 0Cari atau Baca Artikel 11kuliner, tutorial, lowongan kerja DLL 8klik www.dirmanto.web.id 0jangan lupa isi komentarnya yah :)"
  "0,9<3>9,3<1>9,1<11,1 psyBNC, Eggdrop, Shell dan bantuan dasar IRC cari aja di http://dirmanto.web.id/ 9>1,3<9>3,9<0>"
  "0,13<6>13,6<1>6,1<15,1 Kamu² kepingin punya blog pribadi dengan alamat nama-kamu.com ?8 klik http://www.dirmanto.web.id 6,1>1,6<13>6,13<0>"
}

##### DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING #####

if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }

proc go {} {
  global channel time text timer
  foreach chan $channel {
    set line [lindex $text [rand [llength $text]]]
    putserv "PRIVMSG $chan :$line"
  }
  if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
}

putlog "\00315(\003dcL\00304\002!\002\00315)\003 versi 1.0 dijalankan..."

######################################################
# !!!!!! DO NOT EDIT ANYTHING BELOW THIS LINE !!!!!! #
######################################################

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 Trout Slap v1.1 By Dude edited by simpanse \002Loaded...\002"