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 

url kick

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


Joined: 17 Aug 2009
Posts: 9

PostPosted: Mon Aug 17, 2009 4:48 am    Post subject: url kick Reply with quote

hello i need help creating a rather simple(i think) tcl
i want it to detect url spams and (give me the option to choose) warn kick or kickban the user.but please i want it to ignore any youtube links.
can someone help?
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Aug 17, 2009 12:36 pm    Post subject: Reply with quote

I've done a limited amount of testing on the following script and it seems OK. Make sure you use .chanset #channelname +spam in the partyline for each bot channel you want it activated in.

Code:

# spam.tcl
# kicks or kickbans users for spam words/phrases
# functions for channel text, channel actions, channel notices and channel onotices

### --------------------------------------------------------------------------------- ###
### ---------- installation --------------------------------------------------------- ###

# install and source the tcl as normal
# to function in #channelname requires in the partyline .chanset #channelname +spam

### --------------------------------------------------------------------------------- ###
### ---------- configuration -------------------------------------------------------- ###

# set here the list of words/phrases that a user may be punished for
# upper/lower case or mixed doesn't matter
set vSpamPunish {
    "http://"
    "www."
}

# set here the list of words/phrases that a user will not be punished for
# upper/lower case or mixed doesn't matter
set vSpamExempt {
    "youtube"
    "google"
    "myspace"
    "twitter"
}

# set here the punishment mode
# 1 == always kick only
# 2 == kick first time, kickban second
# 3 == always kickban
set vSpamPunishMode 2

# if punishment mode 2 above, set here the time (minutes) to cancel first offence
set vSpamSinTime 2

# set here who on the channel is protected
# 1 == channel ops and voices not protected
# 2 == protect channel ops but not channel voices
# 3 == protect channel ops and voices
set vSpamProtectMode 2

# set here the ban time in minutes
# a setting of 0 means permanent
set vSpamBanTime 2

### --------------------------------------------------------------------------------- ###
### ---------- code ----------------------------------------------------------------- ###

setudef flag spam

bind CTCP - ACTION pSpamCtcp
bind NOTC - * pSpamNotc
bind PUBM - * pSpamPubm

proc pSpamBan {nick chan phrase} {
    global vSpamBanTime
    if {[onchan $nick $chan]} {
        if {[string is integer -strict $vSpamBanTime]} {
            set host [maskhost [getchanhost $nick $chan]]
            pushmode $chan +b $host
            flushmode $chan
            utimer 3 [list pSpamKick $nick $chan $phrase]
            if {$vSpamBanTime > 0} {
                timer $vSpamBanTime [list pSpamUnban $chan $host]
            }
        }
    }
    return 0
}

proc pSpamCheck {nick chan text} {
    global vSpamExempt vSpamProtectMode vSpamPunish
    switch -- $vSpamProtectMode {
        1 {}
        2 {if {[isop $nick $chan]} {return 0}}
        3 {if {([isop $nick $chan]) || ([isvoice $nick $chan])} {return 0}}
        default {return 0}
    }
    set punish 0
    if {[llength $vSpamPunish] != 0} {
        foreach bad $vSpamPunish {
            if {[string match -nocase *${bad}* $text]} {
                set punish 1
                set phrase $bad
                break
            }
        }
        if {[llength $vSpamExempt] != 0} {
            foreach good $vSpamExempt {
                if {[string match -nocase *${good}* $text]} {
                    set punish 0
                    break
                }
            }
        }
    }
    if {$punish} {pSpamPunish $nick $chan $phrase}
    return 0
}

proc pSpamCtcp {nick uhost hand dest keyword text} {
    if {[channel get $dest spam]} {
        if {![isbotnick $nick]} {
            if {[botisop $dest]} {
                pSpamCheck $nick $dest $text
            }
        }
    }
    return 0
}

proc pSpamKick {nick chan phrase {warning ""}} {
    if {[onchan $nick $chan]} {
        switch -- [string length $warning] {
            0 {putkick $chan $nick "spam detected *${phrase}*"}
            default {putkick $chan $nick "spam detected *${phrase}* $warning"}
        }
    }
    return 0
}

proc pSpamNotc {nick uhost hand text dest} {
    set chan [string trimleft $dest @]
    if {[regexp -- {^#} $chan]} {
        if {[channel get $chan spam]} {
            if {![isbotnick $nick]} {
                if {[botisop $chan]} {
                    pSpamCheck $nick $chan $text
                }
            }
        }
    }
    return 0
}

proc pSpamPubm {nick uhost hand chan text} {
    if {[channel get $chan spam]} {
        if {![isbotnick $nick]} {
            if {[botisop $chan]} {
                pSpamCheck $nick $chan $text
            }
        }
    }
    return 0
}

proc pSpamPunish {nick chan phrase} {
    global vSpamPunishMode vSpamSinBin vSpamSinTime
    switch -- $vSpamPunishMode {
        1 {pSpamKick $nick $chan $phrase}
        2 {
            switch -- [info exists vSpamSinBin($nick,$chan)] {
                0 {
                    pSpamKick $nick $chan $phrase "first warning"
                    set vSpamSinBin($nick,$chan) 1
                    timer $vSpamSinTime [list pSpamUnsetSin $nick $chan]
                }
                1 {
                    pSpamBan $nick $chan $phrase
                    pSpamUnsetSin $nick $chan
                }
                default {}
            }
        }
        3 {pSpamBan $nick $chan $phrase}
        default {return 0}
    }
    return 0
}

proc pSpamUnban {chan host} {
    pushmode $chan -b $host
    flushmode $chan
    return 0
}

proc pSpamUnsetSin {nick chan} {
    global vSpamSinBin
    if {[info exists vSpamSinBin($nick,$chan)]} {unset vSpamSinBin($nick,$chan)}
    return 0
}

# eof

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
WisH-GR
Voice


Joined: 17 Aug 2009
Posts: 9

PostPosted: Mon Aug 17, 2009 2:03 pm    Post subject: Reply with quote

thx i will try it and tell u
Back to top
View user's profile Send private message
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