egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bug in swearkick by awyeah

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
CooLB0Y
Voice


Joined: 26 Mar 2004
Posts: 29
Location: Australia

PostPosted: Wed Oct 19, 2005 2:36 am    Post subject: bug in swearkick by awyeah Reply with quote

I found this bug: Tcl error [notc:swear]: illegal channel: @#chan. this error appears on /onotice #chan.

there is a way to fix it?

Code:

# $Id: swearkick.tcl, eggdrop-1.6.x 2004/5 awyeah@usa.net Exp $

# Swear Protection, Channel Swear Kick Script v5.86.b (swearkick.tcl)
#       Script Version: v5.86.b
#       Built Date: 26th June 2004, Last Updated: 2nd September 2004
#       Copyright 1999-2004 awyeah (awyeah@usa.net)
#       This TCL script is designed to work with eggdrop v1.5.x or higher

#########################################################################
#                  Channel Swear Kick Script v5.86.b                    #
#                                                                       #
#                                                                       #
# Author: awyeah                                     2nd September 2004 #
# Email: awyeah@usa.net                            Build version 5.86.b #
# Copyright 2004 awyeah All Rights Reserved    http://www.awyeah.org/ #
#########################################################################
#                                                                       #
# #######                                                               #
# PURPOSE                                                               #
# #######                                                               #
#                                                                       #
# This script will react on any specific words said in a channel.       #
# These specific words will mainly be swear/cuss words which the script #
# will react to based on a few conditions and will punish that user     #
# accordingly to the level of punishment set.                           #
#                                                                       #
# I desperately came up with the idea of this script because, some      #
# people join a channel and immediately start swearing and cussing bad  #
# words and foul language on family oriented channels. This type of     #
# behaviour is not considered friendly or appropriate and they should   #
# be dealt with effectively.                                            #
#                                                                       #
#########################################################################
#                                                                       #
# ###########                                                           #
# DESCRIPTION                                                           #
# ###########                                                           #
#                                                                       #
# This script reacts on swear/cuss and bad words sent into channels via #
# TEXTS, ACTIONS or NOTICES. On detection of any matching word with the #
# defined wordlist the user is punished accordingly to the level of     #
# punishment set by the bot owner.                                      #
#                                                                       #
# This script besides its main swear words catching ability has more    #
# options such as defining owners matching wordlist for swear words     #
# and exemptions for certain flags, hosts and nicks. Also a condition   #
# to change the scripts kicks messages and types of banmasks.           #
#                                                                       #
# This script does not require any invovlement of network services, so  #
# this script can be used on almost any IRC Network.                    #
#                                                                       #
#########################################################################
#                                                                       #
# ########                                                              #
# FEATURES                                                              #
# ########                                                              #
#                                                                       #
# 1. This script has *2* settings of channels to work on.               #
#     (1) It can be activated to work on 'user defined channels'.       #
#     (2) It can be activated to work on 'all channels' the bot is on.  #
#                                                                       #
# 2. Users can define matching words in the swear wordlist to match     #
#    against various types of swear, cuss and bad words.                #
#                                                                       #
# 3. This script will detect swear words from TEXTS, ACTIONS and        #
#    NOTICES sent into channels.                                        #
#                                                                       #
# 4. This script has two different options of matching swear words. One #
#    is which matches word by word, the other being word to sub-word    #
#    or word to any part of the text.                                   #
#                                                                       #
# 5. There are four different levels of punishment options availiable   #
#    to punish the user for.                                            #
#                                                                       #
# 6. This script has an efficient exemption system. It can exempt user  #
#    flags, nicks, user idents, ip address, user hosts as well as       #
#    non-dynamic user idents.                                           #
#                                                                       #
# 7. Users have a choice to choose between the scripts default kick     #
#    message or their own custom kick message.                          #
#                                                                       #
# 8. There is a banmask selector with 20 different ranges of banmasks   #
#    availiable to select from when banning the user.                   #
#                                                                       #
# 9. This script also has a kick counter to record the number of users  #
#    kicked. Kick numbers are show at the end of each kick message.     #
#                                                                       #
#########################################################################
#                                                                       #
# ############                                                          #
# REQUIREMENTS                                                          #
# ############                                                          #
#                                                                       #
# [1] This script is intended to be used on eggdrop 1.5.x/1.6.x or      #
#     higher.                                                           #
#                                                                       #
# [2] This script requires TCL version 8.2 or higher to run.            #
#                                                                       #
#########################################################################
#                                                                       #
# #####                                                                 #
# USAGE                                                                 #
# #####                                                                 #
#                                                                       #
# [1] Please unzip zipped file swearkick.zip file and place the tcl     #
#     file swearkick.tcl file in your eggdrops '/scripts' folder        #
#     along with your other tcl scripts.                                #
#                                                                       #
# [2] Please add a link at the bottom of your eggdrop's .CONF file to   #
#     the path of your swearkick.tcl, it would be something like:       #
#                                                                       #
#       source scripts/swearkick.tcl                                    #
#                                                                       #
# [4] Save your bot's configuration file.                               #
#                                                                       #
# [5] RESTART your eggdrop bot and start kicking filthy swearers!       #
#                                                                       #
#########################################################################
#                                                                       #
# #######                                                               #
# CONTACT                                                               #
# #######                                                               #
#                                                                       #
# - If you have any suggestions, comments, questions or if you want to  #
#   report bugs, please feel free to email me at: awyeah@usa.net        #
#                                                                       #
# - You can contact me on MSN Messenger, on my ID: awyeah@awyeah.org    #
#                                                                       #
# - You can also catch me on IRC (The DALnet Network)                   #
#                                                                       #
#         /server irc.dal.net:6667, Nick: awyeah                        #
#                                                                       #
#########################################################################
#                                                                       #
# ########                                                              #
# VERSIONS                                                              #
# ########                                                              #
#                                                                       #
#  v5.86.b - Added a word matching selection type. Users can now match  #
# (02/09/04) match words by words or match a text containing words      #
#            anywhere, or words containing matching words.              #
#          - Improved the old control code removing filter to new       #
#            standards. Now the control code removing filter has a very #
#            effective regsub for matching all types of colors codes.   #
#          - Replaced 'putserv' with 'putquick -next' for faster bans.  #
#          - Improved the swear exemption options as most of the logics #
#            in the old procedures was incorrect. Added a foreach loop  #
#            to check each exemption option especially for user flags.  #
#          - Improved the dynamic ident exemption matching by using a   #
#            string trim function in the swear word matching procedure. #
#          - Added 'putquick -next' to kick and ban the user along with #
#            the newban and newchanban in the punishment options.       #
#          - Fixed an incorrect variable in the punishing procedure by  #
#            replacing $swearkickmsg with $swearscriptmsg.              #
#          - Removed unncessary string tolower functions which were     #
#            useless as string matching was being used with -nocase.    #
#          - Removed unnecessary brackets which were causing grouping   #
#            of some condition operators.                               #
#                                                                       #
#  v4.75.b - Fixed a condition operator in the newban swear punishment  #
# (18/07/04) function which was duplicating with the newchanban one.    #
#          - Added choices to exempt channel operators, voices and      #
#            bot user flags from swear detection and punishments.       #
#          - Added a channel interface switch. This switch will give    #
#            an option to choose which type of channel interface to     #
#            select from such as CHANNEL TEXT, ACTION, NOTICE or ALL.   #
#          - Added switches for other exemption options so it is easy   #
#            to switch on the ones people will use, if not all.         #
#          - Added an option to choose to only detect users with        #
#            dynamic idents. (Idents which have a "~" sign in front)    #
#          - Upgraded the banmask selector to a new one. It can now     #
#            replace numbers in host.domains with ?'s. (20 types of     #
#            different banmasks are availiable to choose from)          #
#          - Added a unban timer to check if the ban is set on the      #
#            channel before removing it, otherwise the bot uselessly    #
#            unbans some bans which aren't set on the channel even.     #
#          - Removed some unwanted procedures, the total 6 procedures   #
#            have been reduced to only one now.   (More efficiency)       #
#          - Reduced the 3 procedures for specific channels and         #
#            combined all of them in the main procedure now. (The       #
#            detection delay in will be more microseconds faster)       #
#          - Modified all of the procedures, settings and timers to     #
#            give a more faster and efficient performance.              #
#                                                                       #
#  v3.26.b - Initial release of script.                                 #
# (26/06/04)                                                            #
#                                                                       #
#                                                                       #
#  Latest updated verions of this script can be found on the tcl        #
#  archives of the following websites:                                  #
#                                                                       #
#        http://www.egghelp.org/  -  http://www.tclscript.com/          #
#                                                                       #
#########################################################################
#                                                                       #
# #######                                                               #
# CREDITS                                                               #
# #######                                                               #
#                                                                       #
#  - Thanks to my friend NeOmAtRiX for his endless support and help.    #
#                                                                       #
#  - Thanks to user and ppslim for the control code removing filter     #
#    and everyone on forum.egghelp.org for their continuous support.    #
#                                                                       #
#  - Thanks to all my friends who supported me all the way through      #
#    this project and helped me to fix the bugs and errors found        #
#    in this script.                                                    #
#                                                                       #
#                                                                       #
#  ./awyeah                                                             #
#                                                                       #
#########################################################################

##################################################
### Start editing variables from here onwards! ###
##################################################

#----------------------------------------#
#    SETUP CHANNEL ACTIVATION OPTIONS    #
#----------------------------------------#

#Set the type of channels you would like this script to work on.
#USAGE: [1/2] - [1=USER DEFINED CHANNELS, 2=ALL CHANNELS] (You can only enable 'ONE' setting!)
#Use '1' for 'user defined channels' (The script will detect swear words *only* on the channels defined for it)
#Use '2' for 'all the channels' the bot is on. (The script will detect swear words *on every channel* the bot is on)
set sweartype "1"

#Set these to the channels the script will work on, if you have selected to use custom/user-defined channels.
#If not then leave this setting as it is or leave this setting blank. (Seperate channels with spaces)
#USAGE: set swearchans "#channel1 #channel2 #channel3 #mychannel #yourchannel"
set swearchans "#mychannel"


#---------------------------------------#
#    SETUP CHANNEL INTERFACE OPTIONS    #
#---------------------------------------#

#Set the type(s) of channel interface(s) to enable. (MESSAGE, ACTION, NOTICE)
#USAGE: [1/2/3/4] - [1=CHANNEL TEXTS, 2=CHANNEL ACTIONS, 3=CHANNEL NOTICES, 4=ALL]
#Use '1' for detecting swear words from CHANNEL TEXTS. (Will only detect channel texts: /msg #channel)
#Use '2' for detecting swear words from CHANNEL ACTIONS. (Will only detect channel actions: /me #channel)
#Use '3' for detecting swear words from CHANNEL NOTICES. (Will only detect channel notices: /notice #channel)
#Use '4' for detecting swear words from CHANNEL TEXTS, ACTIONS and NOTICES (ALL). (Will detect all the the 3 above!)
set swearactivate "4"


#--------------------------------------#
#    SETUP SWEAR WORD MATCHING TYPE    #
#--------------------------------------#

#Set the type of word matching you would like to use.
#USAGE: [1/2] - [1=WORD BY WORD, 2=WORD IN TEXT]
#EXAMPLES of the matching procedure types. Consider the word 'laugh' to be matched.
# -----------------------------------------------------------------------------------
# Using setting '1' will give the results: (Use this if you are very cautious)
# (1) Hahaha, Laugh out Loud (will match *laugh* as a word) ==> matches
# (2) Look he is laughing! (will 'not' match laugh as word) ==> does not match
# (3) My mom laughs so hard... (will 'not' match laugh as word) ==> does not match
# (4) Do you know how to laugh (will match *laugh* as a word) ==> matches
# (5) Do you know how to laugh? (will 'not' match laugh as a word) ==> does not match
# -----------------------------------------------------------------------------------
# Using setting '2' will give the results: (This setting is recommended)
# (1) Hahaha, Laugh out Loud (will match *laugh* in the text) ==> matches
# (2) Look he is laughing! (will match *laugh* in the text) ==> matches
# (3) My mom laughs so hard... (will match *laugh* in the text) ==> matches
# (4) Do you know how to laugh (will match *laugh* in the text) ==> matches
# (5) Do you know how to laugh? (will match *laugh* in the text) ==> matches
# -----------------------------------------------------------------------------------
#(Note: Setting '1' will detect if 'laugh' is a full-word by having spaces on both sides; while
#setting '2' will detect 'laugh' as a sub-word, or a word matched from any word in the text)
set swearmatchtype "1"


#----------------------------#
#    SETUP SWEAR WORDLIST    #
#----------------------------#

#Set the 'swear words' in the wordlist for the script to trigger on. (Wildcards such as "*" are accepted)
#I have already added most combinations of swear words, so normally you would'nt need to edit these.
#(Note: Please do not use non-aplhanumeric characters such as arabic characters. E.g. ه, , ش, , ذ, ٌ etc)
set swearwords {
"bitch"
"slut"
"biatch"
"my dick"
"my penis"
"my prick"
"slut"
"fucck"
"[censored]"
"nigger"
"nigga"
"faggot"
"prostitute"
"whore"
"lesbian"
"horny"
"orgasm"
"asshole"
"ass hole"
"bastard"
"incest"
"orgy"
"penis"
"vagina"
"clit"
"cyber with"
"cybersex"
"cyber sex"
"jerk off"
"jerking off"
"bigcock"
"hardcock"
"bigdick"
"wetpussy"
"wet pussy"
"big cock"
"big dick"
"huge cock"
"huge dick"
"large cock"
"hard cock"
"large dick"
"wet pussy"
"fuk"
"[censored]"
"fcuk"
"blowjob"
"blow job"
"blow*job"
"lick my pussy"
"my pussy"
"my dick"
"hot pussy"
"hard cock"
"long cock"
"my cock"
"hard dick"
"long dick"
"eat [censored]"
"gay person"
"ass wipe"
"asswipe"
"peice of [censored]"
"suck my dick"
"transvestite"
"homo sexual"
"homosexual"
"have intercourse"
"have * intercourse"
"boobs"
"cumfiesta"
"condom"
"erect"
"phuck"
"masturbat"
"kiss my ass"
"pimp"
"wtf"
"stfu"
}


#------------------------------------#
#    SETUP USER PUNISHMENT METHOD    #
#------------------------------------#

#Set the level of punishment to for the script to use (kick and ban combinations).
#USAGE: [1/2/3/4] - [1=KICK, 2=KICK/BAN, 3=STICKY KICK/BAN, 4=GLOBAL KICK/BAN]
#Use '1' to 'kick' the user from the channel. (Minimal punishment)
#Use '2' to 'kick and ban' the user from the channel. (Moderate punishment)
#Use '3' to 'kick ban' the user from the channel using a sticky ban from the bots ban list. (Extreme punishment)
#Use '4' to 'kick ban' the user from all channels the user is found on *matching* with the bot. (Maximum punishment)
set swearpunish "2"


#-------------------------#
#    SETUP BAN OPTIONS    #
#-------------------------#

#Select the banmask type to use when banning the part/quit message flooder.
# Valid types are:
#  -1 - *nick*!*@*
#   0 - *!user@host.domain
#   1 - *!*user@host.domain
#   2 - *!*@host.domain
#   3 - *!*user@*.domain
#   4 - *!*@*.domain
#   5 - nick!user@host.domain
#   6 - nick!*user@host.domain
#   7 - nick!*@host.domain
#   8 - nick!*user@*.domain
#   9 - nick!*@*.domain
#  You can also specify a type of 10-19 which corresponds to types 0-9,
#  using this sub rule. If host.domain is a:
#    name - Instead of using a * wildcard to replace portions of the host.domain,
#           it replaces the numbers in the host.domain with a '?' (question mark) wildcard.
#    ip   - It will mask as normal, with no '?' (question mark) replacements as does hostname.
#  Example:
#    [#4] awyeah!cool@203.135.67.5 => *!*@203.135.67.*
#    [#14] awyeah!cool@125-628-dialup.cable.mindspring.com => *!*@*.mindspring.com
#    [#2] awyeah!cool@125-628-dialup.cable.mindspring.com => *!*@125-628-dialup.cable.mindspring.com
#    [#12] awyeah!cool@125-628-dialup.cable.mindspring.com => *!*@???-???-dialup.cable.mindspring.com
set swearbantype "12"

#Set the amount of time in minutes to ban the user for. (in mins)
#(By default if you do not set a value the script will assume it to be 60 minutes)
set swearbantime "30"


#-------------------------------#
#    SETUP KICK MESSAGE TYPE    #
#-------------------------------#

#Select the type of kick message you would like the bot to use. There are *2 options* availiable.
#Either use the scripts default kick message or use your own custom kick message.
#USAGE: [1/2] - [1=SCRIPTS DEFAULT KICK MESSAGE, 2=USER DEFINED KICK MESSAGE]
set swearkickswitch "1"

#Set this to your 'customizable kick message' if you have enabled to use your own custom kick message.
#This is currently set to the scripts default kick message - you will need to change this initially.
#(Note: You can include any control codes such as colors, bolds, reverses and underlines in the message)
set swearkickmsg "0,1 Channel Swear Kick 12,0 - 12Unacceptable 2swear word/phrase6 12detected. This is a 2family oriented channel 12so please 2refrain 12from any kind of 2vulgar language."


#-----------------------------------#
#    SETUP USER EXEMPTION OPTIONS   #
#-----------------------------------#

### IMPORTANT NOTE ###
#Listed below are the exemption options for specific userflags, nicks, idents, hosts and userhosts.
#If you do not have any nick, ident, userhost etc to exempt then leave the field as: "" (empty/blank).

#### EXEMPT CHANNEL OPERATORS ####
#Set this if you want the bot to exempt all channel operators, ops (@'s) even though if the
#bot detects swear words from them. (This is a useful setting for not punishing ops)
#USAGE: [0/1] [0=OFF, 1=ON] - [0=WILL NOT EXEMPT OPS, 1=WILL EXEMPT OPS]
#If set to '0' channel ops *will be punished* if the bot detects a swear word from them.
#If set to '1' channel ops *will not be punished* even if the bot detects a swear word from them.
set swearexopswitch "1"

#### EXEMPT CHANNEL VOICES ####
#Set this if you want the bot to exempt all channel voices, (+v's) even though if the bot
#detects swear words from them. (This is a useful setting for not punishing voices)
#USAGE: [0/1] [0=OFF, 1=ON] - [0=WILL NOT EXEMPT VOICES, 1=WILL EXEMPT VOICES]
#If set to '0' channel voices *will be punished* if the bot detects a swear word from them.
#If set to '1' channel voices *will not be punished* even if the bot detects a swear word from them.
set swearexvoiceswitch "1"

#### EXEMPT SPECIFIC USER FLAGS ####
#Set this if you want the bot to exempt user-flags on the bots user list. Users with certain, specific or all
#flags would be exempted by the bot and will not be punished, even if the bot detects swear words from them.
#USAGE: [0/1] [0=OFF, 1=ON] - [0=WILL NOT EXEMPT USERFLAGS, 1=WILL EXEMPT USERFLAGS]
#If set to '0' users/owners on the bots userlist *will be punished* if the bot detects a swear word from them.
#If set to '1' users/owners on the bots userlist *will not be punished* even if the bot detects a swear word from them.
set swearflagswitch "1"

#Set this if you have enabled to exempt certain user-flags on the bots userlist, set the 'flags' for bot owners,
#masters, ops, voices, users etc which will be exempted from this script. Channel and global flags are matched.
#USAGE: "m n o", "v b f", "m n" etc. (Seperate the flags with spaces)
set swearflags "m n o f b v"


#### EXEMPT SPECIFIC NICKS ####
#Set this if you want to 'exempt certain nicks' from the script. Set this to the list of nicks, which
#you would like the bot to ignore and the bot wouldn't check that user for swear words.
#(If you do not have any 'nick' to exempt then, please leave this as: "")
#USAGE: set swearnicks { "spamcheckbot" "myspambot" "myfriend" }
#(Enter nicks in the same way as in your swear wordlist)
set swearnicks {
"myfriend"
}

#### EXEMPT SPECIFIC IDENTS ####
#Set this if you want to 'exempt certain idents' from the script. Set this to the list of idents, which
#you would like the bot to ignore and the bot wouldn't check that user for swear words.
#(If you do not have any 'ident' to exempt then, please leave this as: "")
#WHOIS Example: (For identifying idents)
# ---------------------------------------------------------------------
# awyeah is elite@ircgod.org * Powers by name, powers by reputation...
# awyeah on @#awyeah @#usa @#chatzone @#elite +#drugs
# awyeah using mesra.kl.my.dal.net Fear the dragons.
# awyeah End of /WHOIS list.
# ---------------------------------------------------------------------
#Hence the *ident* in this example on /whois awyeah is: 'elite'.
#USAGE: set swearidents { "userident" "myname" "myident" }
#(Enter idents in the same way as in your swear wordlist)
set swearidents {
"myident"
}

#### EXEMPT SPECIFIC HOSTS ####
#Set this if you want to 'exempt certain hosts' from the script. Set this to the list of hosts, which
#you would like the bot to ignore and the bot wouldn't check that user for swear words.
#(If you do not have any 'host' to exempt then, please leave this as: "")
#WHOIS Example: (For identifying hosts)
# -------------------------------------------------------------------
# awyeah is the@asskicker.com * They have internet on computers now?
# awyeah on @#awyeah @#teens @#eleet +#dalnet #helpdesk @#eggdrops
# awyeah using dragons.ca.us.dal.net DALnet's dragon.
# awyeah End of /WHOIS list.
# -------------------------------------------------------------------
#Hence the *host* in this example on /whois awyeah is: 'asskicker.com'.
#USAGE: { "127.0.0.1" "mindspring.com" "cable.rogers.com" }
#(Enter hosts in the same way as in your swear wordlist)
set swearhosts {
"myispname"
}

#### EXEMPT SPECIFIC USERHOSTS ####
#Set this if you want to 'exempt certain user@hosts' from the script. Set this to the list of userhosts
#which, you would like the bot to ignore and the bot wouldn't check that user for swear words.
#(If you do not have any 'user@host' to exempt then, please leave this as: "")
#WHOIS Example: (For identifying userhosts)
# ---------------------------------------------------------------
# awyeah is yeah@baby.yeah.net * All your base are belong to us!
# awyeah on @#awyeah @#chickspot @#shell @#eggdrop @#bnc
# awyeah using broadway.ny.us.dal.net DALnet's time square.
# awyeah End of /WHOIS list.
# ---------------------------------------------------------------
#Hence the *user@host* in this example on /whois awyeah is: 'yeah@baby.yeah.net'.
#USAGE: { "awyeah@elite.com" "ultimate@asskicker.dal.net" "user@203.135.87" }
#(Enter user@hosts in the same way as in your swear wordlist)
set swearuserhosts {
"i@love.you.com"
}

#### EXEMPT NON-DYNAMIC IDENTS ####
#Set this if you want the script to ignore all users without dynamic idents (idents without ~). Users
#without an "~" sign infront of their ident will be exempted and ignored by the bot if this is enabled.
#Meaning only users with dynamnic idents, idents with the "~" sign will be detected for swear words.
#USAGE: [0/1] [0=OFF, 1=ON] - [0=DO NOT EXEMPT ANY IDENT, 1=ONLY DETECT DYNAMIC IDENTS]
#If set to '0' the script will *not* ignore any ident and will work as a regular script.
#If set to '1' the script will only detect swear words from dynamic idents. (idents with "~")
#(Example #1: awesome@guy.com ===> awesome ===> will *not* be detected for swear words)
#(Example #2: ~awesome@guy.com ===> ~awesome ===> will be detected for swear words)
### NOTE: I recommend you keep this setting *OFF*. (Meaning keep this setting to '0') ###
set sweardynamicident "0"


#---------------------------#
#    SETUP KICK COUNTER     #
#---------------------------#

#Set the filename in which the bot would store the kick counter numbers/records. This file would be
#created in your main *eggdrop* dir where your bot's .conf, .chan, and .user files are stored.
#(You can leave this as it is - if you want)
set swearkicks "swearkicks.dat"


###############################################################################
### Don't edit anything else from this point onwards, even if you know tcl! ###
###############################################################################


bind pubm - * pub:swear
bind notc - * notc:swear
bind ctcp - ACTION act:swear
bind kick - * swear:kick:counter

set swearauthor "awyeah (awyeah@usa.net)"
set swearscript "Channel Swear Kick Script v5.86.b"
set swearchans [split [string tolower $swearchans]]
foreach swearchan $swearchans { channel add $swearchan }

if {![file exists $swearkicks]} {
 putlog "SWEAR KICK COUNTER: The \002swear kick counter file\002 does not exist. Creating file \002$swearkicks\002."
 set file [open $swearkicks "w"]; puts $file 1; close $file
}

proc pub:swear {nick uhost hand chan text} {
 global botnick sweartype swearchans swearactivate
  if {(![string equal $nick $botnick]) && (![string equal -nocase $chan $botnick]) && (($swearactivate == 1) || ($swearactivate == 4))} {; set type TEXT
   if {($sweartype == 1) && ([lsearch -exact [string tolower $swearchans] [string tolower $chan]] != -1)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype == 2)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype != 1) && ($sweartype != 2)} { return 0 }
   }
}

proc act:swear {nick uhost hand chan key text} {
 global botnick sweartype swearchans swearactivate
  if {(![string equal $nick $botnick]) && (![string equal -nocase $chan $botnick]) && (($swearactivate == 2) || ($swearactivate == 4))} {; set type ACTION
   if {($sweartype == 1) && ([lsearch -exact [string tolower $swearchans] [string tolower $chan]] != -1)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype == 2)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype != 1) && ($sweartype != 2)} { return 0 }
   }
}

proc notc:swear {nick uhost hand text {chan ""}} {
 global botnick sweartype swearchans swearactivate
  if {(![string equal $nick $botnick]) && (![string equal -nocase $chan $botnick]) && (![string equal $nick "ChanServ"]) && (($swearactivate == 3) || ($swearactivate == 4))} {; set type NOTICE
   if {($sweartype == 1) && ([lsearch -exact [string tolower $swearchans] [string tolower $chan]] != -1)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype == 2)} { swear:all $nick $uhost $hand $chan $type $text }
   if {($sweartype != 1) && ($sweartype != 2)} { return 0 }
   }
}


proc swear:all {nick uhost hand chan type text} {
 global botnick swearwords swearflags swearkickswitch swearkickmsg swearbantype sweardynamicident swearnicks swearidents
 global swearmatchtype swearhosts swearuserhosts swearkicks swearexopswitch swearexvoiceswitch swearflagswitch swearbantype swearkicks
  set ident [string trimleft [lindex [split $uhost "@"] 0] "~"]; set host [lindex [split $uhost "@"] 1]
  if {($sweardynamicident == "1") && (![string match -nocase "*~*" [lindex [split $uhost "@"] 0]])} { return 0 }
  if {(($swearexopswitch == 1) && ([isop $nick $chan])) || (($swearexvoiceswitch == 1) && ([isvoice $nick $chan]))} { return 0 }
  foreach swearnick $swearnicks { if {([string match -nocase *$swearnick* $nick])} { return 0 } }; foreach swearident $swearidents { if {([string match -nocase *$swearident* $ident])} { return 0 } }
   foreach swearhost $swearhosts { if {([string match -nocase *$swearhost* $host])} { return 0 } }; foreach swearuserhost $swearuserhosts { if {([string match -nocase *$swearuserhost* $uhost])} { return 0 } }
    foreach swearflag $swearflags { if {($swearflagswitch == 1) && ([matchattr $hand $swearflag|$swearflag $chan])} { return 0 } }; set text [swear:filter $text]
     foreach swearword [string tolower $swearwords] {; if {([botisop $chan]) && ([validchan $chan]) && ([onchan $nick $chan])} {
      if {($swearmatchtype == 1) && ([string match -nocase *$swearword* $text])} {
       set swearban [swear:ban $nick!$uhost $swearbantype]; set sweartype $type;
       if {($swearkickswitch == 1)} { swear:kick:script $nick $chan $swearword $sweartype $swearban }
       if {($swearkickswitch == 2) && ($swearkickmsg != "")} { swear:kick:user $nick $chan $swearword $swearban }
       if {($swearkickswitch != 1) && ($swearkickswitch != 2)} { putlog "SWEAR KICK MESSAGE: No kick-message type has been selected."; return 0 } }
      if {($swearmatchtype == 2) && ([string match -nocase "* $swearword *" " $text "])} {
       set swearban [swear:ban $nick!$uhost $swearbantype]; set sweartype $type;
       if {($swearkickswitch == 1)} { swear:kick:script $nick $chan $swearword $sweartype $swearban }
       if {($swearkickswitch == 2) && ($swearkickmsg != "")} { swear:kick:user $nick $chan $swearword $swearban }
       if {($swearkickswitch != 1) && ($swearkickswitch != 2)} { putlog "SWEAR KICK MESSAGE: No kick-message type has been selected."; return 0 } }
      if {($swearmatchtype != 1) && ($swearmatchtype != 2)} { putlog "SWEAR WORD MATCH: No swear word matching-type has been selected."; return 0
      }
    }
  }; return 0
}


proc swear:kick:user {nick chan swearword swearban} {
 global botnick swearpunish swearkicks swearbantime swearkickmsg
  if {(![file exists $swearkicks])} { set file [open $swearkicks "w"]; puts $file 1; close $file }
  set file [open $swearkicks "r"]; set currentkicks [gets $file]; close $file; set totalkicks [expr $currentkicks]; set banmask $swearban
  if {($swearkickmsg == "")} { set swearkickmsg "0,1 Channel Swear Kick 12,0 - 12Unacceptable 2swear word/phrase6 *$swearword* 12detected. This is a 2family oriented channel 12so please 2refrain 12from any kind of 2vulgar language." }
  if {($swearbantime == 0) || ($swearbantime == "") || ($swearbantime < 1)} { set swearbantime 60 }
  if {($swearpunish == 1)} { putquick "KICK $chan $nick :$swearkickmsg2 - (Kick #$totalkicks)" -next }
  if {($swearpunish == 2)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearkickmsg2 - (Kick #$totalkicks)"; timer $swearbantime [list swear:unban $banmask $chan]; return 0 }
  if {($swearpunish == 3)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearkickmsg2 - (Kick #$totalkicks)"; newchanban $chan $banmask swear $swearkickmsg $swearbantime; return 0 }
  if {($swearpunish == 4)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearkickmsg2 - (Kick #$totalkicks)"; newban $banmask swear $swearkickmsg $swearbantime; return 0 }
  if {($swearpunish != 1) && ($swearpunish != 2) && ($swearpunish != 3) && ($swearpunish != 4)} { putlog "SWEAR PUNISHMENT: No punishment type selected."; return 0 }
}

proc swear:kick:script {nick chan swearword sweartype swearban} {
 global botnick swearpunish swearkicks swearbantime
  if {(![file exists $swearkicks])} { set file [open $swearkicks "w"]; puts $file 1; close $file }
  set file [open $swearkicks "r"]; set currentkicks [gets $file]; close $file; set totalkicks [expr $currentkicks]; set banmask $swearban
  set swearmsg "12Unacceptable 2swear word/phrase6 *$swearword* 12detected. This is a 2family oriented channel 12so please 2refrain 12from any kind of 2vulgar language."
  if {($swearbantime == 0) || ($swearbantime == "") || ($swearbantime < 1)} { set swearbantime 60 }
  if {($sweartype == "TEXT")} { set swearscriptmsg "0,1 Channel Text Swear Kick 12,0 - $swearmsg" }
  if {($sweartype == "ACTION")} { set swearscriptmsg "0,1 Channel Action Swear Kick 12,0 - $swearmsg" }
  if {($sweartype == "NOTICE")} { set swearscriptmsg "0,1 Channel Notice Swear Kick 12,0 - $swearmsg" }
  if {($swearpunish == 1)} { putquick "KICK $chan $nick :$swearscriptmsg2 - (Kick #$totalkicks)" -next }
  if {($swearpunish == 2)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearscriptmsg2 - (Kick #$totalkicks)"; timer $swearbantime [list swear:unban $banmask $chan]; return 0 }
  if {($swearpunish == 3)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearscriptmsg2 - (Kick #$totalkicks)"; newchanban $chan $banmask swear $swearscriptmsg $swearbantime; return 0 }
  if {($swearpunish == 4)} { putquick "MODE $chan +b $banmask" -next; putquick "KICK $chan $nick :$swearscriptmsg2 - (Kick #$totalkicks)"; newban $banmask swear $swearscriptmsg $swearbantime; return 0 }
  if {($swearpunish != 1) && ($swearpunish != 2) && ($swearpunish != 3) && ($swearpunish != 4)} { putlog "SWEAR PUNISHMENT: No punishment type selected."; return 0 }
}

proc swear:unban {banmask chan} {
 if {([botisop $chan])} {
  if {([ischanban $banmask $chan])} {
   pushmode $chan -b $banmask; return 0 }
   if {(![ischanban $banmask $chan])} {
    return 0
    }
  }
}


### Thanks to MC_8 for this banmask selector ###
proc swear:ban {{args ""}} {
  swearbadargs $args 1 2 "nick!ident@host.domain ?type?"
  swearunlist $args nuhost type
  set type [expr {($type == "")?5:$type}]
  if {![regexp -- {^(1?[0-9]|-1)$} $type]} {
    set valid "-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 {or 19}"
    error "bad type \"$type\": must be [join $valid ", "]"
  }
  set maskhost 1; set ident_max-length 9; set host_max-length 63
  if {![regexp -- {^(.*[^!])!((.*)@(.*))$} $nuhost -> nick uhost ident host]} {
    error "invalid nick!ident@host.domain: $nuhost"
  }
  if {($type == "-1")} {return *$nick*!*@*}
  if {[string length $type] == "2"} {
    if {[info tclversion] < "8.1"} {
      set re_syntax_1 {([12][0-9][0-9]|[1-9][0-9]|[1-9])}
      set re_syntax_2 {([12][0-9][0-9]|[1-9][0-9]|[0-9])}
    } else {
      set re_syntax_1 {([12]\d{2}|[1-9][0-9]|[1-9])}
      set re_syntax_2 {([12]\d{2}|[1-9][0-9]|[0-9])}
    }
    set re_syntax ^$re_syntax_1\\.$re_syntax_2\\.$re_syntax_2\\.$re_syntax_2\$
    if {![regexp -- $re_syntax $host]} {
      regsub -all -- {[0-9]} $host ? host
      set maskhost 0
    }; set type [string index $type 1]
  }
  if {[string match {[0-4]} $type]} {set nick *}
  if {[string match {[2479]} $type]} {set ident *}
  if {[string match {[1368]} $type]} {regsub -- {^~?(.*)$} $ident *\\1 ident}
  if {[string match {[3489]} $type] && $maskhost} {
    set host [lindex [split [maskhost $host] @] end]
  }
  if {[set length [string length $ident]] > ${ident_max-length}} {
    set ident *[string range $ident [expr $length-${ident_max-length}] end]
  }
  if {[set length [string length $host]] > ${host_max-length}} {
    set host *[string range $host [expr $length-${host_max-length}] end]
  }
  return $nick!$ident@$host
}


proc swearbadargs {{args ""}} {
  if {([llength $args] < 4)} {
    error {
      wrong # args: should be "swearargs args min_llength max_llength argNames"
      }
  }
  set index 0
  foreach varName [list args min max names] {
    set check_$varName [lindex $args $index]
    incr index
  }
  if {[regexp -- {([^0-9])} $check_min -> bad]} {
    error "bad number \"$bad\" in: $check_min"
  }
  if {[regexp -- {([^0-9])} $check_max -> bad] && ($check_max != "end")} {
    error "bad number \"$bad\" in: $check_max"
  }
  if {[catch {llength $check_args} llength]} {
    set check_args [split $check_args]
    set llength $check_args
  }
  if {($llength < $check_min) || (($llength != "end") &&
      ($llength > $check_max))} {
    if {[info level] == "1"} {return 1}
    error "wrong # args: should be \"[lindex [info level -1] 0] $check_names\""
  }; return 0
}

proc swearunlist {{args ""}} {
  swearbadargs $args 1 end "argsList ?varName varName ...?"
  set argList [lindex $args 0]
  set argList [expr {([catch {llength $argList}])?[split $argList]:$argList}]
  set argNames [lrange $args 1 end]
  if {![llength $argNames]} {
    return [expr {(![catch {llength $argList}])?
      [join $argList]:$argList}]
  }
  for {set index 0} {$index < [llength $argNames]} {incr index 1} {
    set argName     [lindex $argNames $index]
    set argListItem [lindex $argList  $index]
    set argName_ [expr {([catch {llength $argName}])?[split $argName]:$argName}]
    set setTo   [lindex $argName_ 1]
    set argName [lindex $argName_ 0]
    if {$argName == ""} {continue}
    upvar 1 $argName var
    if {[expr $index+1] > [llength $argList]} {
      if {[llength $argName_] == "2"} {set var $setTo}
    } else {
      if {$argName == "args"} {
        set var [lrange $argList $index end]
        incr index [expr [llength $var]-1]
      } else {set var $argListItem}
    }
  }; return $index
}


### Thanks to NeOmAtRiX for this kick counter ###
proc swear:kick:counter {nick uhost hand chan target reason} {
 global botnick swearkicks
  if {([string equal $target $botnick])} { return 0 }
  if {([string equal $nick $botnick])} {
   if {![file exists $swearkicks]} {
    putlog "SWEAR KICK COUNTER: The swear kick counter file does not exist. Creating file $swearkicks."
    set file [open $swearkicks "w"]
    puts $file 1; close $file }
    set file [open $swearkicks "r"]
    set currentkicks [gets $file]; close $file
    set file [open $swearkicks "w"]
    puts $file [expr $currentkicks + 1]; close $file
    }
}


### Thanks to user and ppslim for this control code removing filter ###
proc swear:filter {str} {
  regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  return $str
}

putlog "\[LOADED\] by $swearscript \002$swearauthor\002"
if {($sweartype == 2)} { putlog "SWEAR KICKER is \002*ACTIVE*\002 on: \002All channels\002" }
if {($sweartype == 1)} { putlog "SWEAR KICKER is \002*ACTIVE*\002 on: \002[string tolower $swearchans]\002" }
if {(($swearactivate == 1) || ($swearactivate == 2) || ($swearactivate == 3) || ($swearactivate == 4)) && (($sweartype != 1) && ($sweartype != 2))} { putlog "SWEAR KICKER is \002*NOT ACTIVE*\002 because: \002No *channel activation type* has been seletected\002" }
if {(($sweartype == 1) || ($sweartype == 2)) && (($swearactivate != 1) && ($swearactivate != 2) && ($swearactivate != 3) && ($swearactivate != 4))} { putlog "SWEAR KICKER is \002*NOT ACTIVE*\002 because: \002No *channel interface* has been seletected\002" }
if {($sweartype != 1) && ($sweartype != 2) && ($swearactivate != 1) && ($swearactivate != 2) && ($swearactivate != 3) && ($swearactivate != 4)} { putlog "SWEAR KICKER is \002*NOT ACTIVE*\002 because: \002No *channel activation type* and *channel interface* has been seletected\002" }

return

Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Oct 19, 2005 5:55 am    Post subject: Reply with quote

try this notc:swear:

replace:
![string equal -nocase $chan $botnick]
with:
[validchan [set chan [string range $chan [string first # $chan] e]]]

btw you can remove botnick from the global list for that proc then.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
CooLB0Y
Voice


Joined: 26 Mar 2004
Posts: 29
Location: Australia

PostPosted: Wed Oct 19, 2005 11:38 am    Post subject: Reply with quote

its great now Very Happy.

thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber