I know you want to convert it to Tcl, I asked you what's wrong with the Tcl you've wrote? Is there any errors or is there something you don't know how to write in Tcl?
it should not add any nicks or delete the nicks in the bad nick text that are added with when '!delete' is said. And when the person with and in the bad nick text (list) they shoud be automatically banned from the channel
bind pub n !add add:bnick
bind pub n !delete del:bnick
set bnicks [split [read [set file [open "scripts/bnicks.txt"]]] \n][close $file]
unset file
proc add:bnick {n u h c a} {
global bnicks
if {[lsearch -exact $bnicks [set b [string tolower [lindex [split $a] 0]]]] == -1} {
lappend bnicks $b
puthelp "NOTICE $n :Added $b to bad nicks list."
save:bnick
} {
puthelp "NOTICE $n :$b already exists in bad nicks list."
}
}
proc del:bnick {n u h c a} {
global bnicks
if {[set i [lsearch -exact $bnicks [set b [string tolower [lindex [split $a] 0]]]]] != -1} {
set bnicks [lreplace $bnicks $i $i]
puthelp "NOTICE $n :$b has been deleted from the bad nicks list."
save:bnick
} {
puthelp "NOTICE $n :$b does not exist in the bad nicks list."
}
}
proc save:bnick {} {
set a [open "scripts/bnicks.txt" w]
foreach bn $::bnicks {
puts $a $bn
}
close $a
}
The bad nicks list is $bnicks, the file is bnicks.txt located in scripts/ dir.