egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

antirepeat/antiflood

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Sedition
Voice


Joined: 14 Dec 2011
Posts: 17
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Sat Nov 12, 2022 10:13 pm    Post subject: antirepeat/antiflood Reply with quote

I need help for someone to repair this tcl it is very good its function is two in one ..
it is anti repetitions of texts and warns before kicking
It is anti-flood and launches warning phrases before kicking. It worked perfectly until eggdrop version 1.19.

Code:
############################################################
#autokick de flood normal e repeat flood v3.3
#repeatflood and normalfood autokick..
#by fabulous (fabulous@t7ds.com.br)

#ban by banlist(0) or just +b(1) ?
set floodbantype 1

#type of ban to execute:
#ban mask:
#  0 = *!*@host.com
#  1 = *!*ident@host.com
set floodbanmask 1

#which chans to ignore flood? (spaces between them)
set fignorecanais "#enigmas"

#lines to floodnormal are defined on .conf file of the bot (set flood-chan)
#how much repeated lines?
set repeat-kick 3

#ATTENTION: to adjust the max floodlines(not the repeatflood) you must modify the .conf file
#of the bot at "flood-chan" or by .chanset flood-chan l:t (l = lines, t = time)
# kick to throw messages

set fkick(1) "flood try to write everything on one line please.. by writing like this you cause flood..to know our rules type !rules in the open channel"
set fkick(2) "do you like the ban? if you don't like the ban then don't flood please on %chan..to know our rules type !rules in the open channel"
set fkick(3) "Flood don't do it ok.. to know our rules type !rules in the open channel"

#msgs de kick do repeatflood
#kick msgs to repeatflood
set frkick(1) "stop repeating please with one we already read all... to know our rules type ! rules in the open channel"
set frkick(2) "stop repeating or you will be banned, to know our rules type !rules in the open channel"
set frkick(3) "Flood stop, to know our rules type !rules in the open channel"

#ban msg to put in banlist
set fkick(b) "flood detected please just to know our rules type !rules in the open channel"
set frkick(b) "flood for replays calm your enter key to know our rules type !rules in the open channel"

#ban on the second or third line? (2 ou 3)
set banirapos 3

########################################################################
########################################################################

putlog "flood autokick v3.3 by fabulous loaded"

bind flud - pub kick_flood
proc kick_flood {nick uhost hand type chan} {
    global banmesmo fkick fignorecanais
    if {![botisop $chan]} { return 0 }
    if {[isop $nick $chan]} { return 0 }
    foreach c $fignorecanais {
        if {[string toupper $chan] == [string toupper $c]} { return 0 }
    }
    switch [cbf $nick $chan $fkick(b)] {
        "1" { putkick $chan $nick [q $chan $fkick(1)] }
        "2" { putkick $chan $nick [q $chan $fkick(2)] }
        "3" { putkick $chan $nick [q $chan $fkick(3)] }
    }
    return 1
}

proc q {chan args} {
    set args [lindex $args 0]
    regsub -all "%chan" $args "$chan" args
    return $args
}

bind pubm - * repeat_pubm
proc repeat_pubm {nick uhost hand chan text} {
    global repeat_last repeat_num repeat-kick rkicks fignorecanais frkick
    if {![botisop $chan]} { return 0 }
    if {[isop $nick $chan]} { return 0 }
    foreach c $fignorecanais {
        if {[string toupper $chan] == [string toupper $c]} { return 0 }
    }
    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)] >= ${repeat-kick}} {
                switch [cbf $nick $chan $frkick(b)] {
                    "1" { putkick $chan $nick $frkick(1) }
                    "2" { putkick $chan $nick $frkick(2) }
                    "3" { putkick $chan $nick $frkick(3) }
                }
                unset repeat_last($n)
                unset repeat_num($n)
            }
            return
        }
    }
    set repeat_num($n) 1
    set repeat_last($n) $text
}

proc repeat_timr {} {
    global repeat_last
    catch {unset repeat_last}
    catch {unset repeat_num}
    timer 1 repeat_timr
}

if ![regexp repeat_timr [timers]] {
    timer 1 repeat_timr
}

proc cbf {nick chan motv} {
    global banmesmo cbf floodbantype floodbanmask banirapos
    set banmask ""
    set themask [list [getchanhost $nick $chan]]
    set chan [list $chan]
    if {($themask == "*") || ($themask == "")} { return }
    if {![info exists cbf($themask:$chan)]} {
        set cbf($themask:$chan) 1
    } else { incr cbf($themask:$chan) 1 }
    set temp $cbf($themask:$chan)
    if {$banirapos == 2} { if {$temp == 1} {set cbf($themask:$chan) 2 } ; if {$temp == 2} {set cbf($themask:$chan) 3} }
    if {$cbf($themask:$chan) > 2} {
            if {$floodbanmask == "0"} {
                  scan $themask "%\[^@]@%s" banlamer banlamer
                  set banmask *!*@$banlamer
                } {
                  set banmask *!$themask
                }
            if {$floodbantype == 0} {
                  newchanban $chan $banmask bot $motv
                } {
            pushmode $chan +b $banmask
                }
        unset [list cbf($themask:$chan)]
        flushmode $chan
        return 3
    } else {
        timer 5 [list eunset cbf($themask:$chan)]
        return $cbf($themask:$chan)
    }
}

proc eunset {n} {
    if {[info exists $n]} { unset $n }
}


This is the error that I got in the current eggdrop, it only warns but does not apply the ban
Code:
<(reebot> [17:32:46] Tcl error in script for 'timer23119'
[21:49:10] Tcl error [repeat_pubm]: invalid channel: {#mundo}


please someone to fix the time error in applying the ban
_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber