hi and thanks for all scripters
i have a problem for ctcp script version,it don't ban the people don't respond to version reply.
i use this tcl,there is a solution for ban they?
i am a very newbie for bot,and i have problems with some spam client with no ctcp reply.
Salute.
### Settings ###
## Punish the people who have one of the following words in the ctcp-version reply.
set nv_versions {"Excursion" "Bottler" "Masterdrone" "xdcc"}
## Ask ctcp-version if user joins one of these channels.
# Note: Set this to "" to enable punishing on all channels.
set nv_chans "#Quizzer"
## [0/1] If user has a lame IRC-client/script then punish him/her only on $nv_chans?
# Note: If this is set to 0 then the bot punish user on all channels where the bot and the user are.
set nv_onlynvchans 1
## What is the reason for the punishment?
set nv_reason "Bad Client!"
## [0/1] Kick the user?
set nv_kick 1
## [0/1] Give the user a warning?
set nv_givewarning 1
## Give what kind of warning?
set nv_warning "No lame client please!!"
## [0/1] Ban the user?
set nv_ban 1
## Ban for how long time (min)?
set nv_bantime 3
## [0/1] Ignore the user?
set nv_ignore 0
## Ignore for how long time (min)?
set nv_ignoretime 4
## What users can use the nvcheck command?
set nv_chkflag "m"
## Don't ask ctcp-version from the users with the following global flags.
set nv_globflags "m n o b"
## Don't ask ctcp-version from the users with the following channel flags.
set nv_chanflags "m n o f"
###### You don't need to edit below this ######
### Misc Things ###
set nv_ver "1.05"
### Bindings ###
bind join - * join:nv_askver
bind ctcr - VERSION ctcr:nv_ctcp
bind notc - * notc:nv_notice
bind dcc $nv_chkflag nvcheck dcc:nvcheck
### Main Procs ###
proc join:nv_askver {nick uhost hand chan} {
global botnick nv_chans nv_globflags nv_chanflags
if {[string tolower $nick] != [string tolower $botnick]} {
foreach globflag $nv_globflags { if {[matchattr $hand $globflag]} { return 1 } }
foreach chanflag $nv_chanflags { if {[matchattr $hand |$chanflag $chan]} { return 1 } }
if {($nv_chans == "") || ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] != -1)} {
putserv "PRIVMSG $nick :\001VERSION\001"
}
}
}
proc ctcr:nv_ctcp {nick uhost hand dest key arg} {
global botnick nv_versions nv_globflags nv_chanflags
if {[string tolower $nick] != [string tolower $botnick]} {
foreach version $nv_versions {
if {[string match "*[string tolower $version]*" [string tolower $arg]]} {
nv_punish $nick $uhost
}
}
}
}
proc notc:nv_notice {nick uhost hand text {dest ""}} {
global botnick nv_versions nv_globflags nv_chanflags
if {$dest == ""} { set dest $botnick }
if {([string tolower $nick] != [string tolower $botnick]) && ([string match "*version*" [lindex [string tolower $text] 0]])} {
foreach version $nv_versions {
if {[string match "*[string tolower $version]*" [lrange [string tolower $text] 1 end]]} {
nv_punish $nick $uhost
}
}
}
}
proc dcc:nvcheck {hand idx arg} {
set target [lindex [split $arg] 0]
putcmdlog "#$hand# nvcheck $arg"
if {$target == ""} {
putidx $idx "Usage: .nvcheck <nick|channel>"
} else {
putidx $idx "Asking ctcp-version from $target..."
putserv "PRIVMSG $target :\001VERSION\001"
}
}
### Other Procs ###
proc nv_punish {nick uhost} {
global botnick nv_chans nv_onlynvchans nv_reason nv_kick nv_givewarning nv_warning nv_ban nv_bantime nv_ignore nv_ignoretime
set hostmask "*!*[string range $uhost [string first "@" $uhost] end]"
set dowhat ""
if {[string tolower $nick] != [string tolower $botnick]} {
if {$nv_givewarning} {
lappend dowhat "giving warning"
putserv "PRIVMSG $nick :$nv_warning"
}
if {($nv_ignore) && (![isignore $hostmask])} {
lappend dowhat "ignoring"
newignore $hostmask $botnick $nv_reason $nv_ignoretime
}
foreach chan [channels] {
if {($nv_onlynvchans) && ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] == -1)} { continue }
if {($nv_ban) && (![isban $hostmask $chan]) && ([onchan $nick $chan])} {
if {![string match "*banning*" $dowhat]} { lappend dowhat "banning" }
newchanban $chan $hostmask $botnick $nv_reason $nv_bantime
}
if {($nv_kick) && ([botisop $chan]) && ([onchan $nick $chan])} {
if {![string match "*kicking*" $dowhat]} { lappend dowhat "kicking" }
putserv "KICK $chan $nick :$nv_reason"
}
}
if {$dowhat != ""} {
set dowhat "-- [join $dowhat " & "]"
}
putlog "noversions: $nick ($uhost) is using lame IRC-client/script $dowhat"
}
}
### End ###
putlog "TCL loaded: noversions.tcl v$nv_ver by Sup"
set r "no version"
bind join - * foo
bind ctcr - VERSION bar
bind time - * moo
proc foo {n u h c} {
if {[matchattr $h o|o]} return
set ::ver($n) [list [unixtime] $u]
puthelp "privmsg $n :\001VERSION\001"
}
proc bar {n u h d k t} {
if {[isbotnick $d] && [info exists ::ver($n)]} {
unset ::ver($n)
}
}
proc moo {m h d mo y} {
if {[info exists ::ver]} {
foreach {n e} [array get ::ver] {
set t [lindex $e 0]
set u [lindex $e 1]
if {[unixtime] - $t > 30} {
unset ::ver($n)
newban [maskhost $n!$u] $::nick $::r
foreach c [channels] {
if {[botisop $c] && [onchan $n $c]} {
putkick $c $n $::r
}
}
}
}}
}
demond many thanks,work!
But is possible an execption for op?Because someone have bnc and it don't give ctcp reply?The ban is possible in *!*@host.domain ?
Excuse me but i'm a very newbie
Very thanks for the help
change the [matchattr] mask to of|of and add your bnc buddies with +f flag (if you don't know how to do that, go back to reading eggdrop user manuals, this site has plenty of those)
demond wrote:change the [matchattr] mask to of|of and add your bnc buddies with +f flag (if you don't know how to do that, go back to reading eggdrop user manuals, this site has plenty of those)
I have change this setting,but the eggy version and ban all on no reply
Plinsky wrote:yes,they are added with flag of for other tcl,only this don't "see" the setting.
I have change the ban in *!*@host.domain format and work.
the ban mask has nothing to do with your purported problem, you must have messed up something else
yes i have changed the ban mask,but the problem for the ban to +v or +o is another problem.
Other script recognize the flag,this no,ban all
I have put this script in another 2 bot for test,and i have always this problem.
then you either don't have [matchattr $h of|of] in the code (which will skip the version check for users who are +o or +f, global or channel flag) or you don't have your bnc friends added with +f or +o flag, or both - either way, it's your fault, you were told how to fix that but apparently you haven't done so, so just do it and stop complaining already
set r "No client version reply!"
bind join - * foo
bind ctcr - VERSION bar
bind time - * moo
proc foo {n u h c} {
if {[matchattr $h ovf|ovf]} return
set ::ver($n) [list [unixtime] $u]
puthelp "privmsg $n :\001VERSION\001"
}
proc bar {n u h d k t} {
if {[isbotnick $d] && [info exists ::ver($n)]} {
unset ::ver($n)
}
}
proc moo {m h d mo y} {
if {[info exists ::ver]} {
foreach {n e} [array get ::ver] {
set t [lindex $e 0]
set u [lindex $e 1]
if {[unixtime] - $t > 30} {
unset ::ver($n)
newban "*!*[string range $u [string first "@" $u] end]" $::nick $::r
foreach c [channels] {
if {[botisop $c] && [onchan $n $c]} {
putkick $c $n $::r
}
}
}
}}
}