set wordlist "wordlist"
set canal "#ubuntu"
set indice "!"
bind msgm -|- * privados
bind pub m|- ${indice}addword addword
bind pub m|- ${indice}addnicks addnicks
bind pub m|- ${indice}delword delword
bind pub m|- ${indice}delban delban
bind join - * entrada
bind time - "* * * * *" mensaje
bind time - "59 23 * * *" rmban
proc rmban {min hor day mes año} { if {[file exists bans]} { file delete bans } }
proc mensaje {min hor day mes año} {
global canal
global botnick
global owner
if {[botisop $canal] == 1} {putserv "MODE $canal -o $botnick"}
set nicks [chanlist $canal]
set nnicks [llength $nicks]
set find 0
set nuevos ""
if {[file exists avisados]} {
for {set p 0} {$p < $nnicks} {incr p} {
set mask [lindex [split [getchanhost [lindex $nicks $p] $canal] @] end]
set nick [lindex $nicks $p]
set f [open avisados r]
while {[gets $f lineae] != -1} {
if {[string match -nocase "*$nick*" "$lineae"] == 1} {
unset find
set find 1
break
}
}
close $f
if {$find == 0} {
if {[string match -nocase "*NeO-GeO*" $nick] == 0} {
lappend nuevos $nick
if {[isop $nick $canal] == 0 && [matchattr "*$nick*" +h] == 0 && [isvoice $nick $canal] == 0} {
if {[string match -nocase "*$nick*" $botnick] == 0 && [string match -nocase "*$nick*" $owner] == 0 } {
putserv "PRIVMSG $nick :- Prueba AntiSpam - (No responder)" -next
}
}
}
}
unset find
unset mask
unset lineae
unset nick
set find 0
}
if {[llength $nuevos] > 0} {
set fu [open avisados a]
for {set z 0} {$z < [llength $nuevos]} {incr z} {
puts $fu [lindex $nuevos $z]
}
close $fu
}
} else {
set fa [open avisados a]
for {set i 0} {$i < $nnicks} {incr i} {
set mask [lindex [split [getchanhost [lindex $nicks $i] $canal] @] end]
set nick [lindex $nicks $i]
if {[isop $nick $canal] == 0 && [matchattr $nick +h] == 0 && [isvoice $nick $canal] == 0} {
putserv "PRIVMSG $nick :hi" -next
}
puts $fa $nick
}
close $fa
}
}
proc entrada {nick host hand chan} {
global canal
global botnick
set ipv [lindex [split $host @] end]
if {[file exists bans]} {
set fb [open bans r]
while {[gets $fb lineaa] != -1} {
if {[string match -nocase "*$ipv*" $lineaa] == 1} {
if {[botonchan $canal] == 1} {
if {[onchan $nick $canal] == 1} {
if {[isop $nick $canal] == 0 && [matchattr $nick +h] == 0 && [isvoice $nick $canal] == 0} {
putserv "MODE $canal +b *!*@$ipv"
putserv "KICK $canal $nick Bot Spam"
}
}
}
}
}
close $fb
}
}
proc addnicks {nick host hand chan text} {
global canal
set name [lrange $text 0 end]
set nicks [chanlist $canal]
set nnicks [llength $nicks]
set fc [open avisados a]
if {$name == ""} {
for {set i 0} {$i < $nnicks} {incr i} {
puts $fc [lindex $nicks $i]
}
} else {
for {set i 0} {$i < [llength $name]} {incr i} {
puts $fc [lindex $name $i]
}
}
close $fc
}
proc delban {nick host hand chan text} {
global owner
global wordlist
global canal
set word [lrange $text 0 end]
set fd [open bans r]
set ff [open backup a]
while {[gets $fd lineac] != -1} {
if {[string match -nocase $word $lineac] == 0} {
puts $ff $lineac
} else { putquick "MODE $canal -b *!*@$lineac" }
}
close $fd
close $ff
file delete bans
file rename backup bans
putquick "NOTICE $owner :\"$word\" borrado"
}
proc addword {nick host hand chan text} {
global owner
global wordlist
set word [lrange $text 0 end]
set fe [open $wordlist a]
puts $fe $word
close $fe
putquick "NOTICE $owner :\"$word\" añadido al archivo $wordlist"
}
proc delword {nick host hand chan text} {
global owner
global wordlist
set word [lrange $text 0 end]
set fg [open $wordlist r]
set fff [open backup a]
while {[gets $fg linead] != -1} {
if {[string match -nocase $word $linead] == 0} {
puts $fff $linead
}
}
close $fg
close $fff
file delete $wordlist
file rename backup $wordlist
putquick "NOTICE $owner :\"$word\" borrada del archivo $wordlist"
}
proc privados {nick host hand text} {
global wordlist
global canal
global botnick
set ipv [lindex [split $host @] end]
putserv "privmsg $nick :¿ Que hay ?, soy un bot"
if {[isop $nick $canal] == 0 && [matchattr $hand +h] == 0 && [isvoice $nick $canal] == 0} {
if {[file exists $wordlist]} {
set fh [open $wordlist r]
set fff [open bans a]
while {[gets $fh lineaf] != -1} {
if {[string match -nocase $lineaf $text] == 1} {
if {[botonchan $canal] == 1} {
if {[onchan $nick $canal] == 1} {
putserv "PRIVMSG CHaN :op $canal $botnick"
putserv "MODE $canal +b *!*@$ipv"
putserv "KICK $canal $nick Bot Spam"
}
}
puts $fff $ipv
close $fff
close $fh
set fk [open avisados r]
set ffff [open backup a]
while {[gets $fk lineag] != -1} {
if {[string match -nocase "*$nick*" $lineag] == 0} {
puts $ffff $lineag
}
}
close $fk
close $ffff
file delete avisados
file rename backup avisados
break
}
}
}
}
}
putlog "\00304Cargado AntiBots en $canal\00300"
return