I have a tried to code a ban script and also I`m working one a blacklist script and I`m geting some errors:
The code:
Code: Select all
# ban.tcl
# Set here reason and bantime in minutes for bans
set dj(br) "Banned!"
set dj(bt) 1440
# Activate ban times? [1/0]
set dj(bact) 1
###END CFG ###
bind pub n|MASDTO .b s:b
bind pub n|MAS .bl s:black
bind pub n|MAS .black s:black
setudef flag djtools
proc s:b {nick uhost hand chan text} {
global botnick dj
if {[channel get $chan djtools] && ![isbotnick $nick]} {
if {[matchattr $hand n|MASDTO $chan] || [string tolower $chan]} {
set bnick [lindex $text 0]
if {![botisop $chan]} {
puthelp "NOTICE $nick :Error I don't have OP!"
} elseif {$bnick == ""} {
puthelp "NOTICE $nick :SYNTAX\002 .b <nick|*!*@host> \[reason\] \002"
} elseif {![onchan $bnick]} {
puthelp "NOTICE $nick :Error\002 $bnick \002is not on\002 $chan \002Check\002 .b \002"
} else {
set bhost "*!*@[lindex [split $uhost @] 1]"
set bres [lindex $text 1 end]
} else { set bres $dj(br)
newchanban $chan $bhost ban ($hand) $bres $dj(bt)
putquick "KICK $chan $bnick :($hand) $bres"
if {$dj(xb) == 1} {
putserv "PRIVMSG X :ban $chan $bhost 1 100 ($hand) $bres" -next
}
return 1
}
}
}
}
.... it only kick the nickname I`ve typed, and the chanban and Xban is placed on me.... why ?!<me> .b
-|EGG- SYNTAX .b <nick|*!*@host> [reason]
<me> .b lol
-|EGG- Error lol is not on #channel Check .b
<me> .b test1
* |EGG sets mode: -o+b me *!*@me.users.undernet.org
* test1 was kicked by |EGG ((me) )
* Joins: test1 (identd@127.0.0.0)
* You were kicked by X ((egguser) (me))
* Attempting to rejoin channel #channel
* Unable to join channel (address is banned)
-> *x* unban #channel *!*@me.users.undernet.org
-X- Removed 2 pitchforks that matched *!*@me.users.undernet.org
* Rejoined channel #channel


This is the way it should have to work:
and if there is no reason added, the bot will use the defaul reason (in this case $dj(br) )<me> .b
-|EGG- SYNTAX .b <nick|*!*@host> [reason]
<me> .b lol
-|EGG- Error lol is not on #channel Check .b
<me> .b test1 test-reason
* |EGG sets mode: +b *!*@127.0.0.0
* test1 was kicked by |EGG ((me) test-reason)
something like this
<me> .b test2
* |EGG sets mode: +b *!*@127.0.0.1
* test2 was kicked by |EGG ((me) Banned!)