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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
-
simo
- Revered One
- Posts: 1108
- Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo »
greetz gentz i have a question about this tcl that detects repeated characters exceeding 20 like :
hhhhhhhhhhhhhhhhhhhh
h a h a h h a h a h h a h a h h a h a h
hahahhahahhahahhahah
haahaahaahaahaahaahaahaahaahaahaahaa
and so on
Code: Select all
bind pubm - * XantiX:repeatchars:text
proc XantiX:repeatchars:text {nick uhost hand chan text} {
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] "o|o" $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
set text [string map [list \001ACTION ""] [stripcodes abcgru $text]]
set bmask m:[maskhost $nick!$uhost 2]
if {[regexp -nocase {(.)\s*(?:\1\s*){20,}} $text] || [regexp -nocase {(..)\s*(?:\1\s*){20,}} $text]} {
if {![ischanban "$bmask" $chan]} {
if {[isvoice $nick $chan]} { pushmode $chan -v $nick }
pushmode $chan +b $bmask
}
}
}
it seems to freeze the bot not sure why
-
Arnold_X-P
- Master
- Posts: 226
- Joined: Mon Oct 30, 2006 12:19 am
- Location: DALnet - Trinidad - Beni - Bolivia
-
Contact:
Post
by Arnold_X-P »
try this, tweak a few things but it works
Code: Select all
bind pubm - * XantiX:repeatchars:text
bind ctcp - ACTION repeatcharsctcp
proc repeatcharsctcp {nick uhost hand chan keyword arg} {
XantiX:repeatchars:text $nick $uhost $hand $chan $arg
}
proc XantiX:repeatchars:text {nick uhost hand chan text} {
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] "o|o" $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [stripcodes bcruag [string trim $text]] { }]
set bmask m:[maskhost $nick!$uhost 2]
if {[regexp -nocase {(.)\s*(?:\1\s*){10,}} $text] || [regexp -nocase {(..)\s*(?:\1\s*){20,}} $text]} {
if {![ischanban "$bmask" $chan]} {
if {[isvoice $nick $chan]} { pushmode $chan -v $nick }
pushmode $chan +b $bmask
}
}
}
-
Arnold_X-P
- Master
- Posts: 226
- Joined: Mon Oct 30, 2006 12:19 am
- Location: DALnet - Trinidad - Beni - Bolivia
-
Contact:
Post
by Arnold_X-P »
I added something else that was missing.-------------
Code: Select all
bind pubm - * XantiX:repeatchars:text
bind ctcp - ACTION repeatcharsctcp
proc repeatcharsctcp {nick uhost hand chan keyword arg} {
XantiX:repeatchars:text $nick $uhost $hand $chan $arg
}
proc XantiX:repeatchars:text {nick uhost hand chan text} {
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] "o|o" $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [stripcodes bcruag [string trim $text]] { }]
set bmask m:[maskhost $nick!$uhost 2]
if {[regexp -nocase {(.)\s*(?:\1\s*){20,}} $text] || [regexp -nocase {(..)\s*(?:\1\s*){20,}} $text]} {
if {![ischanban "$bmask" $chan]} {
if {[isvoice $nick $chan]} { pushmode $chan -v $nick }
putquick "MODE $chan +b $bmask"
putquick "KICK $chan $nick :you have exceeded the character limits allowed."
}
}
}