This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

I maybe stupid, but still... please help!

Old posts that have not been replied to for several years.
Locked
C
Commari

Post by Commari »

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 :smile:
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...
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Find this line

Code: Select all

proc faith_pub {nick uhost hand text} {
and make it

Code: Select all

proc faith_pub {nick uhost hand chan text} {
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

though that alone won't make it work, as there are many more procs declared with too few arguments.
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Why can't people test their scripts before releasing them? :smile:
C
Commari

Post by Commari »

cheers m8s, could u tell me all the procs that need fixing?

Thx
C
Commari

Post by Commari »

It was working fine...
Until this: wrong # args, should be "botisop channel" ot something like that...
And yes, it sucks when ppl submit bad scripts...

Cheers

a
agoni

Post by agoni »

yeah
search all the lines with

if {![botisop]}{return 0}

and replace them with

if {![botisop $channel]} {return 0}


:smile:

<font size=-1>[ This Message was edited by: agoni on 2001-11-17 14:49 ]</font>
C
Commari

Post by Commari »

Cheers :smile:

It said can't read channel, no such variable... but don't worry, I can fix that by myself :smile:

C
Commari

Post by Commari »

TCL error [faith_pub]: no value given for parameter "word" to "warnnick"

Ffs... what the hell does that mean?
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

It may be that if a user doesn't have a hand, ts leaving out a list item.

Try changing

Code: Select all

if {[lsearch $lowtext $w] > -1} { 
warnnick $nick $uhost $hand [lindex $lowtext [lsearch $lowtext $w]] 
break 
}
to

Code: Select all

if {[lsearch $lowtext $w] > -1} { 
warnnick [list $nick $uhost $hand [lindex $lowtext [lsearch $lowtext $w]]]
break 
}
Locked