| View previous topic :: View next topic |
| Author |
Message |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 9:24 am Post subject: [SOLVED] help with "repeat.tcl v1.1 (9 April 1999)" |
|
|
Hi everyone!
I really need help with this script...
It does what it does well but there are few thingsa it does not do:
1) it does not ignore ops and voices
-> so it bans them too if they repeat
2) then banmask is very bad for big channels!
-> *!*@banmask -> it bans all people from maybe same vhost (bouncers etc). It should be something like blaa@*.blaa.blop
Can anyone help me fast please?
Sincerely Yours
virtanen
Last edited by virtanen on Fri Jan 26, 2007 8:16 am; edited 1 time in total |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 3:32 pm Post subject: |
|
|
There are a lot of anti-repeat scripts out there, try to use another one. Alternatively, you can try and contact the script's author. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 5:16 pm Post subject: |
|
|
I tried few weeks ago, but he hasn't anserwed yet.
And i have tried all repeat scripts from here and all of them has some problems with banning ops, banning masks or those warning, kick, ban situations
It's neither I'm so rookie with this tcl codes or they just dont fit me =) _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 5:51 pm Post subject: |
|
|
I may suggest AllProtection. It has what you want along with a lot of other features.
I am still sure that there is a script that suites your specification in the Tcl archive (I remember using one myself in past times). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 6:03 pm Post subject: |
|
|
| Quote: | #
## 6 ## Text repeating.
#
# use .chanset #channel ap:repeatl <repeats>:<seconds> (in DCC, 0:0 to disable)
# Set default rate here:
lappend ap:udefs {ap:repeatl 0:0}
## Text repeating Kick on how many consecutive repeated letters?
## Example: if this is set to 5 then the bot will kick any user who types (example):
# Hellooooo (5 consecutive o's)
# Hello!!!!!!!!! (5 and more consecutive ! marks)
## Use .chanset #channel ap:repeatc <number-of-letters> (in DCC, 0 to disable)
# Set default value here:
lappend ap:udefs {ap:repeatc 0}
# Text repeating punishment method:
set repeatf(pmeth) 3
# Text repeating ban type.
set repeatf(btype) 3
# Text repeating ban time in minutes. (0 for no ban time)
set repeatf(btime) 15 |
Hmm that repeat script is only for repeating some chars? Or do I understand wrong? I need script which for example bans for repeating "asdaasfh" two times in 3 secs
Thank You for Your fast replies and sorry my noobishm
PS. Is there any short code that I can add to that norepeat script what ignores ops? I handled the banmask but nothing else :*( _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 7:02 pm Post subject: |
|
|
ap:repeatl is for lines:secs and ap:repeatc is for repeated characters (so the first feature is what you want).
You can add to the proc where the kick occurs:
| Code: | | if {[isvoice $nick $chan] || [isop $nick $chan]} {return 0} |
to exempt ops and voices. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 7:11 pm Post subject: |
|
|
did add and got 2 error msg:
"Tcl error [norepeats_pubm]: wrong # args: no script following "{$norepeats(banonrepeat)}" argument"
and when i changed the place
"Tcl error [norepeats_pubm]: extra characters after close-quote"
I'm really sorry to bother You but what did I do wrong I put that code to proc where the ban and kick is but it gives me errors  _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 7:31 pm Post subject: |
|
|
That error has nothing to do with the added line.
Why don't you paste the code (the original, bugless code) and let us help you. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 7:37 pm Post subject: |
|
|
| Code: |
## CONFIGURATION ##
# Default repeat rate flood
# <how many repeats>:<in how many seconds>
set norepeats(default) 0:0
# Ban on repeat? (1 = Yes , 0 = No)
set norepeats(banonrepeat) 1
# If banning on repeat, how many minutes shall they be banned for?
set norepeats(bantime) 15
# Kick/Ban Message to use upon repeat detection?
set norepeats(message) "No repeating allowed "
## END OF CONFIG ##
set norepeats(version) 1.1
set eggversion [string trimleft [lindex $version 1] 0]
if {$eggversion < 1050000} {
proc norepeats_load {} {
global norepeats
if {![file exists $norepeats(file)]} { return 0 }
foreach item [array names norepeats *,rate] {
catch {unset $norepeats($item)}
}
set infile [open "$norepeats(file)" r]
while {![eof $infile]} {
gets $infile dataline
if {$dataline != ""} {
set dchan [lindex [split $dataline] 0]
set drate [lindex [split $dataline] 1]
if {[validchan $dchan]} { set norepeats($dchan,rate) $drate }
}
}
close $infile
foreach chan [channels] {
if {![info exists norepeats([string tolower $chan],rate)]} {
set norepeats([string tolower $chan],rate) $norepeats(default)
}
}
return 1
}
proc norepeats_save {} {
global norepeats
set outfile [open "$norepeats(file)" w]
foreach chan [channels] {
if {![info exists norepeats([string tolower $chan],rate)]} {
set norepeats([string tolower $chan],rate) $norepeats(default)
}
puts $outfile "[string tolower $chan] $norepeats([string tolower $chan],rate)"
}
close $outfile
return 1
}
set norepeats(file) "${nick}.rpd"
regsub -all -- \\\| $norepeats(file) _ norepeats(file)
regsub -all -- \\\[ $norepeats(file) _ norepeats(file)
regsub -all -- \\\] $norepeats(file) _ norepeats(file)
regsub -all -- \\\} $norepeats(file) _ norepeats(file)
regsub -all -- \\\{ $norepeats(file) _ norepeats(file)
regsub -all -- \\\' $norepeats(file) _ norepeats(file)
if {![file exists $norepeats(file)]} {
set outfile [open "$norepeats(file)" w]
foreach chan [channels] {
puts $outfile "[string tolower $chan] $norepeats(default)"
}
close $outfile
catch {unset outfile}
catch {unset chan}
}
bind time - "10 * * * *" norepeats_time_save
proc norepeats_time_save {mi ho mo da yr} {
putloglev o * "Saving norepeats data ..."
norepeats_save
}
proc norepeats_rate {chan} {
global norepeats
if {![validchan $chan]} { return "0:0" }
if {![info exists norepeats([string tolower $chan],rate)]} {
set norepeats([string tolower $chan],rate) "$norepeats(default)"
}
return "$norepeats([string tolower $chan],rate)"
}
bind dcc n norepeats norepeats_dcc
proc norepeats_dcc {hand idx text} {
global norepeats
set what [string tolower [lindex $text 0]]
if {($what == "") || ![regexp set|mset|info $what]} {
putdcc $idx "Usage: norepeats <set|info> <channel> \[value\]"
return
}
switch $what {
"set" {
set chan [lindex $text 1]
set rate [lindex $text 2]
if {($chan == "") || ($rate == "") || ![string match "*:*" $rate]} {
putdcc $idx "Usage: norepeats set <channel> <repeats>:<seconds>"
return 0
}
if {![validchan $chan]} {
putdcc $idx "Invalid channel $chan"
return 0
}
set norepeats([string tolower $chan],rate) $rate
putdcc $idx "Repeat rate for $chan is now $rate"
norepeats_save
return 1
}
"info" {
set chan [string tolower [lindex $text 1]]
if {![validchan $chan]} {
putdcc $idx "Invalid channel $chan"
return 0
}
if {![info exists norepeats($chan,rate)]} {
set norepeats($chan,rate) $norepeats(default)
}
set num [lindex [split $norepeats($chan,rate) ":"] 0]
set sec [lindex [split $norepeats($chan,rate) ":"] 1]
putdcc $idx "Repeat rate for $chan: $num repeats in $sec seconds"
return 1
}
default {
putdcc $idx "Usage: norepeats <set|info> <channel>"
return 0
}
}
}
} else {
setudef int repeat-lines
setudef int repeat-time
proc norepeats_rate {chan} {
global norepeats
if {![validchan $chan]} { return "0:0" }
set chaninfo [channel info $chan]
set res ""
set res [lindex [lindex $chaninfo [lsearch $chaninfo "*repeat-lines*"]] 1]
append res ":"
append res [lindex [lindex $chaninfo [lsearch $chaninfo "*repeat-time*"]] 1]
if {$res == ":"} {
channel set $chan repeat-lines [lindex [split $norepeats(default) ":"] 0]
channel set $chan repeat-time [lindex [split $norepeats(default) ":"] 1]
set res $norepeats(default)
}
return "$res"
}
}
proc handisop {hand chan} {
return [expr {[validchan $chan] && [isop [hand2nick $hand $chan] $chan]}]
}
if {($eggversion >= 1030000)} {
proc matchchanattr {handle flags channel} { return [matchattr $handle |$flags $channel] }
}
proc isoporvoice {nick chan} {
return [expr {[validchan $chan] && ([isop $nick $chan] || [isvoice $nick $chan])}]
}
proc handisoporvoice {hand chan} {
return [expr {[validchan $chan] && [isoporvoice [hand2nick $hand $chan] $chan]}]
}
proc mymatchattr {hand flags {chan ""}} {
if {[regsub -all {[^&|().a-zA-Z0-9@+#-]} $flags {} f]} {
putloglev o * "error: (matchattr): illegal character in flags: $flags"
return 0
}
regsub -all -- {[|&]} $f {&&} f
regsub -all -- {#-} $f {-#} f
regsub -all -- {-} $f {!} f
regsub -all -- {#?[a-zA-Z0-9]} $f {(&)} f
regsub -all -- {\(#([a-zA-Z0-9])\)} $f {[matchchanattr $hand \1 $chan]} f
regsub -all -- {\(([a-zA-Z0-9])\)} $f {[matchattr $hand \1]} f
regsub -all -- {\.} $f {1} f
regsub -all -- {@} $f {[handisop $hand $chan]} f
regsub -all -- {\+} $f {[handisoporvoice $hand $chan]} f
return [expr $f]
}
proc norepeats_cleanqueue {chan} {
global norepeats
set chan [string tolower $chan]
if {![info exists norepeats($chan,queue)]} { set norepeats($chan,queue) "" }
set newqueue ""
set rate [norepeats_rate $chan]
set time [lindex [split $rate ":"] 1]
foreach item $norepeats($chan,queue) {
set when [lindex $item 3]
if {[expr [clock seconds] - $when] <= $time} {
lappend newqueue $item
}
}
set norepeats($chan,queue) $newqueue
}
proc norepeats_updatequeue {nick chan text} {
global norepeats
set nick [string tolower $nick]
set chan [string tolower $chan]
set text [string tolower $text]
set rate [norepeats_rate $chan]
if {$rate == "0:0"} { return }
if {![info exists norepeats($chan,queue)]} { set norepeats($chan,queue) "" }
set patt ""
set pattt ""
set nickt $nick
regsub -all -- \\\\ $nickt \\\\\\\\ nickt
regsub -all -- \\\[ $nickt \\\\\[ nickt
regsub -all -- \\\] $nickt \\\\\] nickt
regsub -all -- \\\} $nickt \\\\\} nickt
regsub -all -- \\\{ $nickt \\\\\{ nickt
lappend patt $nick
lappend pattt $nickt
lappend patt $text
lappend pattt $text
set fnd [lsearch $norepeats($chan,queue) "$pattt *"]
if {$fnd == -1} {
lappend patt "1"
lappend patt "[clock seconds]"
lappend norepeats($chan,queue) $patt
norepeats_cleanqueue $chan
return
}
set item [lindex $norepeats($chan,queue) $fnd]
set times [lindex $item 2]
incr times
set first [lindex $item 3]
lappend patt $times
lappend patt $first
set norepeats($chan,queue) [lreplace $norepeats($chan,queue) $fnd $fnd $patt]
norepeats_cleanqueue $chan
return
}
# nick text times first
proc norepeats_checkqueue {nick chan text} {
global norepeats
set now [clock seconds]
set nick [string tolower $nick]
set chan [string tolower $chan]
set text "[string tolower $text]"
if {![info exists norepeats($chan,queue)]} { set norepeats($chan,queue) "" }
set patt ""
regsub -all -- \\\\ $nick \\\\\\\\ nick
regsub -all -- \\\[ $nick \\\\\[ nick
regsub -all -- \\\] $nick \\\\\] nick
regsub -all -- \\\} $nick \\\\\} nick
regsub -all -- \\\{ $nick \\\\\{ nick
lappend patt $nick
lappend patt $text
set rate [norepeats_rate $chan]
set num [lindex [split $rate ":"] 0]
set time [lindex [split $rate ":"] 1]
if {$rate == "0:0"} { return 0 }
set fnd [lsearch $norepeats($chan,queue) "$patt *"]
if {$fnd == -1} { return 0 }
set item [lindex $norepeats($chan,queue) $fnd]
set times [lindex $item 2]
set first [lindex $item 3]
if {$times < $num} { return 0 }
if {[expr $now - $first] > $time} { return 0 }
return 1
}
bind pubm - * norepeats_pubm
proc norepeats_pubm {nick uhost hand chan text} {
global botnick norepeats
if {![isop $botnick $chan] || [mymatchattr $hand f|#f $chan] || ([norepeats_rate $chan] == "0:0")} { return }
norepeats_updatequeue $nick $chan "$text"
if {[norepeats_checkqueue $nick $chan "$text"]} {
if {$norepeats(banonrepeat)} {
newchanban $chan "*!*@[lindex [split $uhost "@"] 1]" repeating $norepeats(message) $norepeats(bantime)
}
putserv "KICK $chan $nick :$norepeats(message)"
}
return
}
bind ctcp - ACTION norepeats_action
proc norepeats_action {nick uhost hand dest key text} {
global norepeats botnick
if {![validchan $dest] || ![isop $botnick $dest] || [mymatchattr $hand f|#f $dest] || ([norepeats_rate $dest] == "0:0")} {
return
}
set chan $dest
norepeats_updatequeue $nick $chan "$text"
if {[norepeats_checkqueue $nick $chan "$text"]} {
if {$norepeats(banonrepeat)} {
newchanban $chan "*!*@[lindex [split $uhost "@"] 1]" repeating $norepeats(message) $norepeats(bantime)
}
putserv "KICK $chan $nick :$norepeats(message)"
}
return
}
bind time - "*5 * * * *" norepeats_cleanqueues
bind time - "*0 * * * *" norepeats_cleanqueues
proc norepeats_cleanqueues {mi ho da mo yr} {
global norepeats
foreach chan [channels] {
set newqueue ""
if {[info exists norepeats($chan,queue)]} {
set chan [string tolower $chan]
set rate [norepeats_rate $chan]
set time [lindex [split $rate ":"] 1]
foreach item $norepeats($chan,queue) {
set when [lindex $item 3]
if {[expr [clock seconds] - $when] <= $time} {
lappend newqueue $item
}
}
set norepeats($chan,queue) $newqueue
}
}
}
if {$eggversion < 1050000} {utimer 1 "norepeats_load"}
putlog "norepeats.tcl v$norepeats(version) by strikelight now loaded" |
and I have changed the ban mask to
| Code: | | "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]" |
that shouldn't make the problem.
And there is not now the line You told me to put if i want to extempt ops and voices. Sorry this slownes Just learning how to use this forum  _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 7:48 pm Post subject: |
|
|
I think i got it =) $host just has to change to $uhost
DUMB ME!
EDIT:
THANK YOU VERY MUCH FOR YOUR HELP AND TIME! _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 7:56 pm Post subject: |
|
|
| Code: | proc norepeats_pubm {nick uhost hand chan text} {
global botnick norepeats
# add
if {[isvoice $nick $chan] || [isop $nick $chan]} {return 0} |
and
| Code: | proc norepeats_action {nick uhost hand dest key text} {
global norepeats botnick
if {![validchan $dest] || ![isop $botnick $dest] || [mymatchattr $hand f|#f $dest] || ([norepeats_rate $dest] == "0:0")} {
return
}
# add
if {[isvoice $nick $dest] || [isop $nick $dest]} {return 0} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
virtanen Voice
Joined: 25 Jan 2007 Posts: 8
|
Posted: Thu Jan 25, 2007 8:00 pm Post subject: |
|
|
I put it one or two lines upper and it did work.
I really want to thank you for your time and help.
I couldn't finnish this myself.
Thanks you from freeeeeezing Finland  _________________ - virtanen -
Suomi - Finland |
|
| Back to top |
|
 |
strikelight2 Voice
Joined: 02 Jan 2007 Posts: 5
|
Posted: Sun Jan 28, 2007 11:21 pm Post subject: |
|
|
| Fyi, there is a newer version of the script you are using over at www.tclscript.com (v1.3) from Nov'02, which exempts ops that are not in the bot's userlist as you want. |
|
| Back to top |
|
 |
|