Here's the script:
# faith.tcl : by Jay Monk
# (named after the original irc bot from which
# this idea was obtained)
# If you have suggestions or just like this script,
# please let me know at
jaym@utdallas.edu
# Don't use pico to edit this file! (It'll
# break
# up the long
# lines)
# NOTE: this script uses
# bind join - %
# bind nick - %
# bind topic - *
# bind pubm - *
# bind dcc m report
# If you have other scripts which use these same bindings, you are
# going to have to change the bindings to something different or
# not load those other scripts
# If you are cursing up a storm and your bot isn't doing anything,
# check: 1) do you have a +m flag? 2) is the bot oped?
# 3) is there a pattern for that word or nick in the appropriate
# list?
# COMMANDS ADDED WITH THIS SCRIPT
# all commands require +m except .report which requires +o
# typing any of the .add* or .del* commands with no args
# returns the current word/nick list
# .addword <word> adds word to wordlist
# .addnick <nick> adds nick to nicklist
# .delword <word> deletes word from wordlist
# .delnick <nick> deletes nick from nicklist
# .report shows report of this script's activity
# .savewords saves words and nicks to a file
# .clwarn kind of useless, just clears
# addresses from warning memory
# note: words/nicks *must* be in lower case to correctly
# match. wildcards * and ? may also be used
# SCRIPT BEHAVIOR
# Word offenses:
# +m users: nothing
# +f users: private warning, no logging
# all others: warning on 1st offense, kickban on 2nd
# Nick offenses:
# +m & +f users: private warning, no logging
# all others: warning on 1st offense, kickban on 2nd
# Topic offenses:
# everyone: topic is changed automatically, private
# warning
# If the bot can't find your word file (like the first time you run
# this script) it will take these words and nicks as a default
# and make a new word file when you use the .savewords command
# There's really no need to mess with these 2 variables, changes
# can be made and saved much better on-line
# Remember! all lower case
set badwords {*[censored]* *[censored] [censored]*}
set badnicks {god *[censored]* *[censored] [censored]*}
# What file should the words be saved in?
set faithwords {faith.words}
# I *highly* suggest not changing anything below this line unless
# you know what you're doing..
#################################################################
if [info exists faithwords] {
if [file exists $faithwords] {
set badwords ""
set badnicks ""
set f [open $faithwords r]
while {[gets $f line] >= 0} {
switch [string index $line 0] {
+ {append badwords " " [string trimleft $line +]}
= {append badnicks " " [string trimleft $line =]}
}
}
close $f
putlog "Words loaded from file: $faithwords"
}
} else {
set faithwords {faith.words}
}
bind dcc m savewords save_words
proc save_words {hand idx args} {
global badwords badnicks faithwords
set f [open $faithwords w]
foreach w $badwords {
puts $f "+[string trim $w]"
}
foreach w $badnicks {
puts $f "=[string trim $w]"
}
flush $f
putdcc $idx "Words saved to file: $faithwords"
close $f
return 1
}
bind pubm - * faith_pub
proc faith_pub {nick uhost hand text} {
if {[matchattr $hand m]} {return 0}
global badwords
set lowtext [string tolower $text]
foreach w $badwords {
if {[lsearch $lowtext $w] > -1} {
warnnick $nick $uhost $hand [lindex $lowtext [lsearch $lowtext $w]]
break
}
}
}
bind join - % faith_join
proc faith_join {nick uhost hand} {
global badnicks
set lownick [string tolower $nick]
foreach w $badnicks {
if {[string match $w $lownick]} {
warnnick2 $nick $uhost $hand
break
}
}
}
bind nick - % faith_nick
proc faith_nick {nick uhost hand newnick} {
global badnicks
set lownewnick [string tolower $newnick]
foreach w $badnicks {
if {[string match $w $lownewnick]} {
warnnick2 $newnick $uhost $hand
break
}
}
}
bind topc - * faith_topic
proc faith_topic {nick uhost hand topic} {
if {![botisop]} {return 0}
global badwords channel btopic
set lowtopic [string tolower $topic]
foreach w $badwords {
if {[lsearch $lowtopic $w] > -1} {
putserv "TOPIC $channel :02Welcome to $channel"
putserv "NOTICE $nick :02Please do not use offensive language in the channel topics"
incr btopic
break
}
}
}
proc warnnick {nick uhost hand word} {
if {[matchattr $hand f]} {
putserv "NOTICE $nick :02Please do not say '$word' here"
return 0
}
if {![botisop]} {return 0}
global channel badmouth kword bword
if {[string length $badmouth] > 400} {
set badmouth ""
}
if {[lsearch -exact $badmouth [maskhost $uhost]] > -1} {
regsub {*!} [maskhost $uhost] *!* da_ban
if {[isop $nick]} {
putserv "MODE $channel -o+b $nick $da_ban"
} else {
putserv "MODE $channel +b $da_ban"
}
putserv "KICK $channel $nick :02Sorry $nick, but you were warned about your language02"
incr kword
} else {
putserv "PRIVMSG $channel :02This is your only warning $nick! Do not use offensive language on $channel!!"
append badmouth " [maskhost $uhost]"
putserv "NOTICE $nick :02You are being warned for saying: $word"
incr bword
}
}
proc warnnick2 {nick uhost hand} {
if {[matchattr $hand m] || [matchattr $hand f]} {
putserv "NOTICE $nick :02Please do not use offensive nicks here"
return 0
}
if {![botisop]} {return 0}
global channel badmouth knick bnick
if {[string length $badmouth] > 400} {
set badmouth ""
}
if {[lsearch -exact $badmouth [maskhost $uhost]] > -1} {
regsub {*!} [maskhost $uhost] *!* da_ban
if {[isop $nick]} {
putserv "MODE $channel -o+b $nick $da_ban"
} else {
putserv "MODE $channel +b $da_ban"
}
putserv "KICK $channel $nick :02Sorry, but you were warned about your language02"
incr knick
} else {
putserv "MODE $channel +b $nick"
putserv "KICK $channel $nick :02You may not use that nick on $channel02"
append badmouth " [maskhost $uhost]"
putserv "NOTICE $nick :02Please change nicks and rejoin"
incr bnick
}
}
bind dcc m clwarn clear_warnings
proc clear_warnings {hand idx args} {
global badmouth
set badmouth ""
putdcc $idx "Warning memory has been cleared."
return 1
}
bind dcc m addword add_word
proc add_word {hand idx word} {
global badwords
if {$word != ""} {
set word [string tolower $word]
foreach w $word {
if {[lsearch -exact $badwords $w] < 0} {
append badwords " $w"
putdcc $idx "Word added: $w"
}
}
}
putdcc $idx "BADWORDS: $badwords"
return 1
}
bind dcc m addnick add_nick
proc add_nick {hand idx nick} {
global badnicks
if {$nick != ""} {
set nick [string tolower $nick]
foreach w $nick {
if {[lsearch -exact $badnicks $w] < 0} {
append badnicks " $w"
putdcc $idx "Nick added: $w"
}
}
}
putdcc $idx "BADNICKS: $badnicks"
return 1
}
bind dcc m delword del_word
proc del_word {hand idx word} {
global badwords
if {$word != ""} {
set word [lindex $word 0]
set delindex [lsearch -exact $badwords $word]
if {$delindex == -1} {
putdcc $idx "$word was not found in the bad words list"
} else {
putdcc $idx "Word deleted: $word"
set badwords [lreplace $badwords $delindex $delindex]
}
}
putdcc $idx "BADWORDS: $badwords"
return 1
}
bind dcc m delnick del_nick
proc del_nick {hand idx nick} {
global badnicks
if {$nick != ""} {
set nick [lindex $nick 0]
set delindex [lsearch -exact $badnicks $nick]
if {$delindex == -1} {
putdcc $idx "$nick was not found in the bad nicks list"
} else {
putdcc $idx "Nick deleted: $nick"
set badnicks [lreplace $badnicks $delindex $delindex]
}
}
putdcc $idx "BADNICKS: $badnicks"
return 1
}
if {![info exists bnick]} {
set bnick 0
set bword 0
set btopic 0
set kword 0
set knick 0
set badmouth ""
}
bind dcc o report give_rep
proc give_rep {hand idx args} {
global botnick bnick bword btopic kword knick badmouth
putdcc $idx "[string toupper $botnick]'s ON-LINE REPORT"
putdcc $idx "Word warnings: $bword"
putdcc $idx "Word kicks: $kword"
putdcc $idx "Nick warnings: $bnick"
putdcc $idx "Nick kicks: $knick"
putdcc $idx "Bad topics: $btopic"
putdcc $idx " "
if {$badmouth == ""} {
putdcc $idx "No offenders in memory"
} else {
putdcc $idx "OFFENDERS([llength $badmouth]):$badmouth"
}
return 1
}
And this is the problem: [16:48] TCL error [faith_pub]: called "faith_pub" with too many arguments
What does that mean? (My English sucks)
Thank u...