This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Repeat protection script.

Old posts that have not been replied to for several years.
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Repeat protection script.

Post by Nucleus »

I am currently using this script for repeat protection, but its obviously not fast enough. Other bots on the channel kick users that say 5 lines in 5 seconds, and mine is configured to ban at 3 lines in 5 seconds, and the other bots are still faster than mine. And i know it's not lag, because other scripts like the inviting protection works very fast.

What i need is very simple. When someone says the same thing, 3 times in 5 seconds, then the bot puts a channel ban. I have already searched, and there is no such script. Can someone do it for me pls?

Code: Select all

# Number of repeats before kicking
set repeatkick 3
# In how many seconds
set repeattime 30
# Also ban?
set repeatban 1


# Don't edit below unless you know what you're doing
bind pubm - * repeat_pubm
bind ctcp - ACTION repeat_action
bind nick - * repeat_nick

proc repeat_pubm {nick uhost hand chan text} {
  if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
  global repeat_last repeat_num repeatkick repeatban repeatbantime
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeatkick}} {
        if {$repeatban} {
          set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
          pushmode $chan +b $banmask
          puthelp "KICK $chan $nick :Repeating "
        }
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

proc repeat_action {nick uhost hand dest keyword text} {
  if {[matchattr $nick mo|mo $dest] || [isop $nick $dest] || [isvoice $nick $dest] || [matchattr $nick o|o $dest]} {return 0} 
  global botnick altnick repeat_last repeat_num repeatkick repeatban repeatbantime
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeatkick}} {
        if {$repeatban} {
          set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
        }
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

proc repeat_nick {nick uhost hand chan newnick} {
  if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
  global repeat_last repeat_num
  catch {set repeat_last([set nn [string tolower $newnick]]) \
         $repeat_last([set on [string tolower $nick]])}
  catch {unset repeat_last($on)}
  catch {set repeat_num($nn) $repeat_num($on)}
  catch {unset repeat_num($on)}
}

proc repeat_timr {} {
  global repeat_last repeattime
  catch {unset repeat_last}
  catch {unset repeat_num}
  utimer $repeattime repeat_timr
}

if ![regexp repeat_timr [utimers]] {
  utimer $repeattime repeat_timr
}

putlog "=====>> Repeat Protection Loaded"
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Re: Repeat protection script.

Post by De Kus »

Code: Select all

          pushmode $chan +b $banmask
          puthelp "KICK $chan $nick :Repeating "
replace above with below:

Code: Select all

          newchanban $chan $banmask repeat "Repeating" 5
the number is bantime in minutes. This should be a lot faster than puthelp. don't forgot that regular ops can't remove these bans unless they login to partyline or you have an extra script for that purpose.

PS: if this isn't fast enough the only other solution is to directly unqueued put to the IRC idx which isn't recommned at all as long you bot has no IRC server side flood exception.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

no no, i need regular ops to be able to remove the ban, that is why i wanted the bot to put the ban in the channel banlist, not in the bot's internal ban list.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Replace this:

Code: Select all

 set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
 pushmode $chan +b $banmask
 puthelp "KICK $chan $nick :Repeating"

with this:

Code: Select all

 putquick "MODE $chan +b *!*[string range $uhost [string first @ $uhost] end]" -next
 putquick "KICK $chan $nick :Repeating" -next
Then you might be able to see some difference in the speed.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I don't think it's neseccary to use -next here, a normal putquick is fast enough.
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

Great! It bans and kicks within a second. Thanks :)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well the -next option only pushes it up the queue, so its like dead fast. Also similar results can be achieved with the undocumented 'putdccraw' which sends a string of text directly to the server, without any queue, though I've seen people complaining theres a queue for that too, beleive me my bot gets excess flood with putquick -next sometimes, heh. I've tested both putquick with -next and putdccraw, they are basically at the same speed. :D
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

For such kicks, putserv is enough IMO. I use putquick -next for locking on floods only.
h
helpme
Voice
Posts: 17
Joined: Sun May 08, 2005 11:07 am

Post by helpme »

how can i change the bantime? i want only 10 min. bans
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Currently in that script there is no ban time. If you want the ban to be removed after 10 minutes then add the following line:

Code: Select all

timer 10 [list pushmode $chan -b $banmask]
after the kick line.
h
helpme
Voice
Posts: 17
Joined: Sun May 08, 2005 11:07 am

Post by helpme »

dont work anymore :/ is this right?

putquick "MODE $chan +b *!*[string range $uhost [string first @$uhost]end]" -next
putquick "KICK $chan $nick :Repeating" -next
timer 10 [list pushmode $chan -b $banmask]
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

There is no $banmask in your code, instead use:

Code: Select all

putquick "MODE $chan +b [set banmask *!*[string range $uhost [string first @ $uhost] end]]" -next 
putquick "KICK $chan $nick :Repeating" -next 
timer 10 [list pushmode $chan -b $banmask]
User avatar
awesomeawyeah
Voice
Posts: 4
Joined: Sun Jun 26, 2005 8:40 am
Location: irc.awyeah.org
Contact:

Post by awesomeawyeah »

helpme wrote:dont work anymore :/ is this right?

putquick "MODE $chan +b *!*[string range $uhost [string first @$uhost]end]" -next
putquick "KICK $chan $nick :Repeating" -next
timer 10 [list pushmode $chan -b $banmask]
By the looks of this, try this it is more better:

Code: Select all

set banmask "*!*[lindex [split $uhost @] 1]"
putquick "MODE $chan +b $banmask" -next
putquick "KICK $chan $nick :Repeating" -next
timer 10 [list pushmode $chan -b $banmask]
h
helpme
Voice
Posts: 17
Joined: Sun May 08, 2005 11:07 am

Post by helpme »

I found a better Script, this won't kick opped/voiced users, and has a bantimer. But i can remove the bans only over the Partyline, can you pls fix this, i want that ops to be able to remove the bans.



# by Tris, 17jul96 (v2)
# action added by fantomas 22Dec1997

# Updated to v4 (17 November 1998) by slennox <slenny@ozemail.com.au>
# About time someone updated this nice little script that more
# people should be using :-)
# - Updated for 1.3 bots (channel specific +o user no longer kicked)
# - Added options to set number of kicks in how many seconds
# and kick msg
# - Added option to ban as well as kick
#
# Fixed version (1 December 1998)
# - repeatban set to 1 was generating 'invalid command name' error.
# I'd forgotten to add 'fixbanmask' proc (stolen from subop*.tcl by
# MHT & YaZZ) :-)
#
# Updated to v4.1 (8 December 1998)
# - Got rid of the fixbanmask crap and changed ban type to an IP ban :-)

# Updated (25 November 2002) @/+ exempt
# - Now this script won't kick opped/voiced users. I added an op/voice exempt to this script
# originally made by Tris and modified by users listed above. (|am|) @ DALnet amit@amit.mu

# Number of repeats before kicking
set repeatkick 3
# In how many seconds
set repeattime 10
# Kick msg
set repeatmsg "Stop Flooding"
# Also ban?
set repeatban 1
# How long the ban should last (in minutes)
set repeatbantime 10


# Don't edit below unless you know what you're doing
bind pubm - * repeat_pubm
bind ctcp - ACTION repeat_action
bind nick - * repeat_nick

proc repeat_pubm {nick uhost hand chan text} {
if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
global repeat_last repeat_num repeatkick repeatmsg repeatban repeatbantime
if [info exists repeat_last([set n [string tolower $nick]])] {
if {[string compare [string tolower $repeat_last($n)] \
[string tolower $text]] == 0} {
if {[incr repeat_num($n)] >= ${repeatkick}} {
if {$repeatban} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
newchanban $chan $banmask repeat $repeatmsg $repeatbantime
}
putserv "KICK $chan $nick :$repeatmsg"
unset repeat_last($n)
unset repeat_num($n)
}
return
}
}
set repeat_num($n) 1
set repeat_last($n) $text
}

proc repeat_action {nick uhost hand dest keyword text} {
if {[matchattr $nick mo|mo $dest] || [isop $nick $dest] || [isvoice $nick $dest] || [matchattr $nick o|o $dest]} {return 0}
global botnick altnick repeat_last repeat_num repeatkick repeatmsg repeatban repeatbantime
if [info exists repeat_last([set n [string tolower $nick]])] {
if {[string compare [string tolower $repeat_last($n)] \
[string tolower $text]] == 0} {
if {[incr repeat_num($n)] >= ${repeatkick}} {
if {$repeatban} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
newchanban $dest $banmask repeat $repeatmsg $repeatbantime
}
putserv "KICK $dest $nick :$repeatmsg"
unset repeat_last($n)
unset repeat_num($n)
}
return
}
}
set repeat_num($n) 1
set repeat_last($n) $text
}

proc repeat_nick {nick uhost hand chan newnick} {
if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
global repeat_last repeat_num
catch {set repeat_last([set nn [string tolower $newnick]]) \
$repeat_last([set on [string tolower $nick]])}
catch {unset repeat_last($on)}
catch {set repeat_num($nn) $repeat_num($on)}
catch {unset repeat_num($on)}
}

proc repeat_timr {} {
global repeat_last repeattime
catch {unset repeat_last}
catch {unset repeat_num}
utimer $repeattime repeat_timr
}

if ![regexp repeat_timr [utimers]] { # thanks to jaym
utimer $repeattime repeat_timr
}

putlog "repeat.tcl (@/+ exempt) by |am| originally made by Tris loaded"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

replace

Code: Select all

newchanban $chan $banmask repeat $repeatmsg $repeatbantime
with

Code: Select all

putquick "KICK $chan $nick :$repeatmsg"
putuqick "MODE $chan +b $banmask"
timer $repeatbantime [list pushmode $chan -b $banmask]
Locked