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.

problem with advertisekick.tcl

Old posts that have not been replied to for several years.
Locked
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

problem with advertisekick.tcl

Post by dossi »

I'm having a problem with awyeah's advertisekick.tcl script

When someone advertises their channel, it kicks them but does not ban them. Here is the error I get in the partyline:

Code: Select all

[00:56] Tcl error [pub:advertise]: wrong # args: should be "timer minutes command"
Here is the script:

Code: Select all

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

# Begin - Channel Advertise/Spam Kicker Script v3.92.b (advertisekick.tcl)
#	Script Version: v3.92.b
#	Built Date: March 2004, Last Updated: 4th July 2004
#	Copyright © 1999-2004 awyeah (awyeah@usa.net)
#	TCL script was designed to work with eggdrop v1.5.x or higher

#########################################################################
#  	        Channel Advertise/Spam Kicker Script v3.92.b 	            #
#								                        # 
#							  	                        #
# Author: awyeah					                4th July 2004 #
# Email: awyeah@usa.net				         Build version 3.92.b #
# Copyright © 2004 awyeah All Rights Reserved	 http://www.awyeah.org/ #
#########################################################################
#												#
# #################						                  #
# PURPOSE OF SCRIPT					                        #
# #################									#
#								        			#
# This script serves the purpose of eliminating advertisers, spammers	#
# and inviters who join channels and advertise their channels or 		#
# websites on the main channel window, with or without a flood.		#
#								                        #
# This script is quite efficient and can detect almost any kind of      #
# spam, invite, or advertise sent into a chanenl. The main is for this	#
# effectiveness are the wordlist matching wildcards I have added.		#
#												#
# This script can be run on almost any network on IRC because it does 	#
# not utilize/invovle any network services.					#
#												#
#########################################################################
#												#
# #####################								      #
# DESCRIPTION OF SCRIPT						                  #
# #####################									#
#							                              #
# This script will make your eggdrop bot detect any spam, invite words	#
# sent into the channel. It will *not* simply detect single characters	#
# or words (such as #), which can cause chaos.					#
#						                        		#
# After the eggdrop bot has matched the wildcards in a channel text,	#
# action or notice which seems relevant to an advertise or spam message	#
# it, verifying this it will punish that user depending upon the		#
# punishment level select by the bot owner.					#
# 												#
# This is a very effective script to eliminate spammers and advertisers	#
# which join channels and spam their channels or websites.			#
#								                        #
#########################################################################
#								                        #
# ###############								      	#
# SCRIPT FEATURES						                  	#
# ###############										#
#								                        #
# 1. This script will not ban on detecting any single characters/words	#
#    in a text or action of a user. Supponsingly:				#
#												#
#   It *WILL NOT* not ban for texts similar to this:				#
#												#
#   - My cell phone # is 0800-856345 (for the # character)			#
#   - Will you join me tommorow for a game of badminton? (for *join*)	#
#   - Please do come to my wedding! (for *come to*)				#
#   - My aunt is going to visit us tommorow!! (for *to visit*)		#
#   - You can go to their counter and signup for..... (for *go to*)	#
#												#
#   It *WILL* ban for texts similar to this:					#
#												#
#   - #mychannel #mychannel #mychannel #mychannel #mychannel		#
#   - #mychannel#mychannel#mychannel#mychannel#mychannel#mychannel	#
#   - Please join #mychannel, /j #mychannel,					#
#   - visit #mychannel, visit http://* (same for *come to* and *goto*)	#
#   - click here #mychannel, check out www.*					#
#												#
# 2. This script will also not ban people in a channel, if they say 	#
#    the channel's name. (For example: If someone on the channel 		#
#    #funchat, says a text which includes the word #funchat, this		#
#    script will ignore the user and exempt him). Some scripts which 	#
#    I have seen would punish the user for saying the channel's name, 	#
#    which is quite annoying.								#
#												#
# 3. 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 the channels the bot is on.	#
#												#
# 4. This script has switches to choose either to exempt channel ops,	#
#    voices and users with certain flags. It also has an effective	#
#    exemption system such as exemption of specific nicks, idents,	#
#    hosts, user@host's. It can also exempt all non-dynamic idents.	#
#												#
# 5. This script will detect TEXT, ACTION as well as channel NOTICES. 	#
#    Each of the *3* detection systems can be individually choosen to 	#
#    be enabled or disabled with the channel-interface type selector.	#
# 												#
# 6. This script also has an option to either use the scripts default	#
#    kick message when punishing the user, or either defining your own 	#
#    kick message and using that.						      #
#												#
# 7. This script also has a kick counter logger. It will keep a record 	#
#    of how many people are kicked with the script. The number of users	#
#    kicked will be shown in the end of each kick message.			#
#												#
# 8. Also availiable are 20 types of bans which can be selected by bot 	#
#    owners with varying wilcards. These banmasks enforce a greater 	#
#    range of customizable bans for banning advertisers and spammers. 	#
#												#
#########################################################################
#								                        #
# ###################								      #
# SCRIPT INSTALLATION						                  #
# ###################									#
#								                        #
# [1] Please unzip the advertisekick.zip zipped file & place the 		#
#     advertisekick.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 the advertisekick.tcl, it would be something like:    #
#								                        #
#            source scripts/advertisekick.tcl					#
#								                        #
#								                        #
# [3] Save your bot's configuration file						#
#						                        		#
# [4] *RESTART* your eggdrop bot and start kicking advertiser ass!	#
#								                        #
#########################################################################
#								                        #
# ############									      #
# CONTACT INFO							                  #
# ############										#
#								                        #
# - 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			      #
#									                  #
#########################################################################
#									                  #
# ###############								      	#
# SCRIPT VERSIONS					                  		#
# ###############										#
#												#
#  v3.92.b  - Added a channel interface switch. This switch will give	#
# (04/07/04)  an option to choose which type of channel interface to	#
#		  select from such as CHANNEL TEXT, ACTION, NOTICE or	ALL.	#
#           - Fixed a missing line punishment line in the options where #
#		  the scripts random kick message is displayed.			#
#           - Added choices to exempt channel operators, voices and	#
#		  bot user flags from advertisement detection.			#
#	      - 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)	#
#		- There were 2 matching ban types on the banmask selector,	#
#		  removed the duplicate one and added a new banmask type.	#
#           - 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.	#
#		- Added an option to either select the scripts default kick #
#		  message when punishing the user or defining your own 	#
#		  customizable kick message.						#
#	      - Removed unwanted procedures, the total 6 procedures	have 	#
#             been reduced to *1* single procedure, which makes the 	#
#             script more cpu and ram friendly.					#
#		- Added some more matching words in the advertise detection #
#		  wordlist.									#
#		- Modified all of the procedures, settings and timers to	#
#		  give a more faster and efficient performance.			#
#												#
#  v2.85.b  - Fixed the kick counter initial file creation bug, so the	#
# (14/06/04)  kick counter file will be always checked before kicking.	#
#	      - Added support for channel NOTICES as well, so script 	#
#             will react on any notices sent in channels.			#
#		- Added 20 different types of banmasks to select from 	#
#		  while banning the spammer.						#
#		- Added a choice to select the default script kick message	#
#		  or use your own customizable kick message.			#
#												#
#  v1.28.b  - Initial release of script.						#
# (30/05/04)										#
#												#
#									                  #
#  Latest released 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 friends who came up with the idea of this script,	#
#    because without them this wouldn't have been possible.			#
#												#
#  - A very special thanks all my friends who did the beta testing for 	#
#    this script and helped me to fix the bugs and errors found.		#
#												#
#  - Thanks to ppslim for providing the control code removing filter.	#
#												#
#												#
#   Really great work people!								#
#												#
#												#
# ./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' (Will detect/punish the user only in the channels defined for the script)
#Use '2' for 'all the channels' the bot is on. (Will detect/punish the user on any channel where he/she advertised)
set advertisetype "1"

#Set this if you have set the previous setting to '1' for user defined channels, if not then please
#leave this as it is or leave this as empty/blank. (Set the channels on which this script would work)
#USAGE: set advertisechans "#channel1 #channel2 #channel3 #mychannel #yourchannel"
set advertisechans "#test-a"


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

#Set the type of channel interface 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 advertisments from CHANNEL TEXTS. (Will only detect channel texts: /msg #channel)
#Use '2' for detecting advertisments from CHANNEL ACTIONS. (Will only detect channel actions: /me #channel)
#Use '3' for detecting advertisments from CHANNEL NOTICES. (Will only detect channel notices: /notice #channel)
#Use '4' for detecting advertisements from CHANNEL TEXTS, ACTIONS and NOTICES (ALL). (Will detect all channel texts, actions and notices)
set advertiseactivate "4"


#----------------------------------------------#
#    SETUP ADVERTISEMENT DETECTION WORDLIST    #
#----------------------------------------------#

#Set the *advertise words* for the script to react on. (wildcards such as "*" are accepted)
#Already have pre-added all kinds of combinations, normally you would'nt need to edit these. 
#People only edit would need to edit if their language or channel not english.
set advertisewords {
"#*#*"
"*#*#*"
"#*#*#*"
"*#*#*#*"
"#* #*"
"*#* #*"
"#* #* #*"
"*#* #* #*"
"#* *#*"
"*#* *#*"
"#* *#* *#*"
"*#* *#* *#*"
"#* * #*"
"#* * *#*"
"*#* * #*"
"*#* * *#*"
"#* * #* * #*"
"#* * *#* *#*"
"*#* * #* * #*"
"*#* * *#* *#*"
"*/join #*"
"*join #*"
"*join* #*"
"*/join"
"*/join*"
"*/j0in #*"
"*j0in #*"
"*/j0in"
"*/j0in*"
"*/j #*"
"*/j* #*"
"*/j* * #*"
"*join#*"
"*join*#*"
"*j0|n#*"
"*j0|n*#*"
"*j0in#*"
"*j0in*#*"
"*jo|n#*"
"*jo|n*#*"
"*join to * * #*"
"*join to your #*"
"*join to your * #*"
"@hix*"
"*prank calls*"
"*prank call*"
"*recruiting #*"
"*contest #*"
"*in #*"
"#* OMG"
"#* growing*"
"#*"
}


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

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


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

#Select the type of banmask to use when banning the advertiser.	
# 1 - *!*@some.host.com
# 2 - *!*@*.host.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.host.com
# 5 - *!*ident*@*.host.com
# 6 - *!*ident*@some.host.com
# 7 - nick*!*@*.host.com
# 8 - *nick*!*@*.host.com
# 9 - nick*!*@some.host.com
# 10 - *nick*!*@some.host.com
# 11 - nick!ident@some.host.com
# 12 - nick!ident@*.host.com
# 13 - *nick*!*ident@some.host.com
# 14 - nick*!*ident*@some.host.com
# 15 - *nick*!*ident*@some.host.com
# 16 - nick!*ident*@some.host.com
# 17 - nick*!*ident@*.host.com
# 18 - nick*!*ident*@*.host.com
# 19 - *nick*!*ident@*.host.com
# 20 - *nick*!*ident*@*.host.com
set advbanmask "1"

#Set the amount of time in minutes to ban the user for. (in mins)
#(By default if you don't set a value the script will assume it to be 60 minutes)
set advertisebantime "2"


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

#Set this if you would like to use your own KICK message for kicking the advertiser.
#If you set this OFF then the scripts default kick message will be used.
#USAGE: [0/1] (O=OFF, 1=ON)
set advkickswitch "1"

#Set this if to your customizable KICK message if you have enabled to use your own custom KICK message.
#By Default this is set to the scripts default kick message. (You will need to change this)
set advkickmsg "Bad word detected. (2 minute ban)"


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

### IMPORTANT NOTE ###
#For all of the exemption settings below please *DO NOT* use wildcards
#such as: (*, !, *!*, *@*, *!*@*, @*.host.com, *@127.0.0.* etc as they maybe risky)
#(If you do not have any ident, userhost, or ip to enter then please leave the field "")


#### EXEMPT CHANNEL OPERATORS ####
#Set this if you want the bot to exempt all channel operators - ops (@'s) even though if the
#bot has detected an advertise matching word 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 an advertise word from them
#If set to '1' channel ops will be exempted even if the bot detects an advertise word from them
set advexopswitch "1"

#### EXEMPT CHANNEL VOICES ####
#Set this if you want the bot to exempt all channel voices (+v's) even though if the bot has 
#detected an advertise matching word 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 an advertise word from them
#If set to '1' channel voices will be exempted even if the bot detects an advertise word from them
set advexvoiceswitch "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 an advertise word 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 an advertise word from them
#If set to '1' users/owners on the bots userlist will be exempted even if the bot detects an advertise word from them
set advexflagswitch "1"

#If you have enabled to exempt userflags on the bots userlist and not to punish them, set the 'user flags' 
#for bot owners, masters, ops, voices, users etc which will be exempted from this script.
#(Try not to leave this field empty, atleast fill it with "n" to exempt the bot owner if possible)
#Example: n=owner, m=master, o=op, v=voice, f=friend, b=bot etc
#USAGE: m, n, o, v, f or "mnf", "bfv" etc
set advexflags "mnof|mnof"


#### EXEMPT SPECIFIC NICKS ####
#Set this if you want to enable 'exemption of specific nicks' from this script. (Users with such nicks will be 
#ignored by the script even if they are found to be advertising)
#USAGE: [0/1] (0=OFF, 1=ON)
set advnickswitch "0"

#Set this if you have selected/enabled to 'exempt certain nicks' (if you have set the previous setting to '1'). 
#Set this to the list of 'exempted nicks', which you would like the bot to ignore and wouldn't want to check that 
#user for advertisement words. (If you do not have any 'nick' to exempt then, please leave this as "")
#USAGE: "nick1, bot3, user5, robot7"
set advexnicks ""


#### EXEMPT SPECIFIC IDENTS ####
#Set this if you want to enable 'exemption of specific idents' from this script. (Users with such idents will be 
#ignored by the script even if they are found to be advertising)
#USAGE: [0/1] (0=OFF, 1=ON)
set advidentswitch "0"

#Set this if you have selected/enabled to 'exempt certain idents' (if you have set the previous setting to '1').
#Set this to the list of exempted 'user idents' which you would like the bot to ignore when checking users for 
#advertisement words. (If you do not have any 'user ident' to exempt then, please leave this as "")
#(Whois example: awyeah is cooldude@loves.you.com ===> cooldude)
#USAGE: "cooldude, myident, user, script, sweet"
set advexidents "a-user-ident"


#### EXEMPT SPECIFIC HOSTS ####
#Set this if you want to enable 'exemption of your hosts' from this script. (Users with such hosts will be ignored
#by the script even if they are found to be advertising)
#USAGE: [0/1] (0=OFF, 1=ON)
set advhostswitch "0"

#Set this if you have selected/enabled to 'exempt certain hosts' (if you have set the previous setting to '1').
#Set this to the list of 'exempted domains' (user ip addresses) which you would like the bot to ignore 
#when checking for advertisement words. (If you do not have any 'ip addresses' to exempt then, please leave this as "")
#(Whois example: awyeah is cooldude@adsl-154-462.cable.myisp.com ===> cable.myisp.com)
#USAGE: "cable.myisp.com, name.myuniversity.edu, mindspring.com, cpe.net.cable.rogers.com"
set advexhosts "an-isp-name"


#### EXEMPT SPECIFIC USER HOSTS ####
#Set this if you want to enable 'exemption certain user@hosts' from this script. (Users with such user@host's will be
#ignored by the script even if they are found to be advertising)
#USAGE: [0/1] (0=OFF, 1=ON)
set advuserhostswitch "0"

#Set this if you have selected/enabled to 'exempt certain hosts' (if you have set the previous setting to '1').
#Set this to the list of 'user hosts' (user@host) which you would like the bot to ignore when checking for 
#advertisement words. (If you do not have any 'user@host' to exempt then, please leave this as "")
#USAGE: "rules@127.0.0.1, i@am.eleet.com, yeah@baby.yeah.net"
set advexuserhosts "i@love.you.com"


#### EXEMPT NON-DYNAMIC IDENTS ####
### NOTE: I recommend you keep this setting *OFF*. (Meaning keep this setting to '0') ###
#Set this to ignore users without dynamic idents (idents without ~). Users without a "~" sign infront of their 
#ident will be exempted and ignore by the bot if this setting is enabled and will not be detected for advertisement words.
#USAGE: [0/1] (0=OFF, 1=ON) - (0=DO NOT EXEMPT ANY IDENT, 1=EXEMPT ONLY NON-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 ignore normal idents (idents without "~" ) and will only detect adverisement 
#words from dynamic idents (idents which have a "~" sign in the beginning of their ident)
#(When enabled: awyeah is awesome@guy.com ===> awesome ==> Will make the user exempted)
#(When enabled: awyeah is ~awesome@guy.com ===> ~awesome ===> Will *NOT* make the user exempted)
set advdynamicident "0"


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

#Set the filename in which you want the user kick record numbers to be stored in. 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 advertisekicks "advertisekicks.dat" 


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


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

proc pub:advertise {nick uhost hand chan text} {
 global botnick advertisetype advertisechans
  if {($nick != $botnick) && ($chan != $botnick)} {; set type "TEXT"
   if {($advertisetype == 1) && ($advertisechans != "") && ([string match "#*" $advertisechans])} { pub:specific:chans $nick $uhost $hand $chan $type $text }
   if {($advertisetype == 2)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
   if {(($advertisetype != 1) && ($advertisetype != 2)) || ($advertisetype == "0") || ($advertisetype == "")} { return 0 }
   }
}

proc pub:specific:chans {nick uhost hand chan type text} {
 global botnick advertiseactivate advertisechans
  if {($advertiseactivate == 1) || ($advertiseactivate == 4)} {
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] != -1)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] == -1)} { return 0 }
  }
}


proc act:advertise {nick uhost hand chan key text} {
 global botnick advertisetype advertisechans
  if {($nick != $botnick) && ($chan != $botnick)} {; set type "ACTION"
   if {($advertisetype == 1) && ($advertisechans != "") && ([string match "#*" $advertisechans])} { act:specific:chans $nick $uhost $hand $chan $type $text }
   if {($advertisetype == 2)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
   if {(($advertisetype != 1) && ($advertisetype != 2)) || ($advertisetype == "0") || ($advertisetype == "")} { return 0 }
   }
}

proc act:specific:chans {nick uhost hand chan type text} {
 global botnick advertiseactivate advertisechans
  if {($advertiseactivate == 2) || ($advertiseactivate == 4)} {
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] != -1)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] == -1)} { return 0 }
  }
}


proc notc:advertise {nick uhost hand text {chan ""}} {
 global botnick advertisetype advertisechans
  if {($nick != $botnick) && ($chan != $botnick) && (![string equal $nick "ChanServ"])} {; set type "NOTICE"
   if {($advertisetype == 1) && ($advertisechans != "") && ([string match "#*" $advertisechans])} { notc:specific:chans $nick $uhost $hand $chan $type $text }
   if {($advertisetype == 2)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
   if {(($advertisetype != 1) && ($advertisetype != 2)) || ($advertisetype == "0") || ($advertisetype == "")} { return 0 }
   }
}

proc notc:specific:chans {nick uhost hand chan type text} {
 global botnick advertiseactivate advertisechans
  if {($advertiseactivate == 3) || ($advertiseactivate == 4)} {
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] != -1)} { advertise:all:chans $nick $uhost $hand $chan $type $text }
  if {([lsearch -exact [split [string tolower $advertisechans]] [string tolower $chan]] == -1)} { return 0 }
  }
}


proc advertise:all:chans {nick uhost hand chan type text} {
 global botnick advertisewords advexflags advkickswitch advkickmsg advdynamicident advexnicks advexidents advexhosts advexuserhosts 
 global advertisekicks advexopswitch advexvoiceswitch advexflagswitch advnickswitch advidentswitch advhostswitch advuserhostswitch 
  set text [advertise:filter $text]; set userident [lindex [split $uhost "@"] 0]; set ipaddress [lindex [split $uhost "@"] 1]
  if {![file exists $advertisekicks]} { set file [open $advertisekicks "w"]; puts $file 1; close $file }
  if {($advdynamicident == "1") && (![string match "*~*" $userident])} { return 0 }
  if {(($advnickswitch == 1) && ($advexnicks != "") && ([string match -nocase *$advexnicks* $nick])) || (($advidentswitch == 1) && ($advexidents != "") && ([string match -nocase *$advexidents* $userident])) || (($advhostswitch == 1) && ($advexhosts != "") && ([string match -nocase *$advexhosts* $ipaddress])) || (($advuserhostswitch == 1) && ($advexuserhosts != "") && ([string match -nocase *$advexuserhosts* $uhost])) } { return 0 }
  if {([string match -nocase *$chan* $text])} { return 0 }
  foreach advertiseword [string tolower $advertisewords] {
   if {[string match -nocase *$advertiseword* $text]} {
   if {(($advexopswitch == 1) && ([isop $nick $chan])) || (($advexvoiceswitch == 1) && ([isvoice $nick $chan])) || (($advexflagswitch == 1) && ([matchattr $hand $advexflags $chan]))} { return 0 }
    if {($nick != $botnick) && ($chan != $botnick) && ([botisop $chan]) && ([validchan $chan]) && (![string match -nocase *$chan* $text]) && ([onchan $nick $chan])} {
     set advertiseban [advertise:banmask $uhost $nick]; set advertisetype $type;
     if {($advkickswitch == 1) && ($advkickmsg != "")} { advertise:kick:user $nick $chan $advertiseword $advertiseban; return 0 }
     if {($advkickswitch == 0)} { advertise:kick:script $nick $chan $advertiseword $advertisetype $advertiseban; return 0 }
      if {(($advkickswitch != 1) && ($advkickswitch != 0)) || ($advkickswitch == "")} { putlog "ADVERTISE KICK MESSAGE: No kick-message type selected."; return 0 }
      }
    }
  }
}


proc advertise:kick:user {nick chan advertiseword advertiseban} {
 global botnick advertisepunish advertisekicks advertisebantime advkickmsg
  set file [open $advertisekicks "r"]; set currentkicks [gets $file]; close $file; set totalkicks [expr $currentkicks]; set banmask $advertiseban
  if {($advkickmsg == "")} { set advkickmsg "0,1 Channel Advertise Kick 12,0 - 2Advertise/Invite 12word 6\"$advertiseword\" 12detected. Mass 2Advertising/Inviting/Spamming 12in 12is not tolerated on this 2channel. 12Failing to 2comply 12with 2these rules 12will result into a 2permanent ban." }
  if {($advertisebantime == 0) || ($advertisebantime == "") || ($advertisebantime < 1)} { set advertisebantime 60 }
  if {($advertisepunish == 1)} { putquick "KICK $chan $nick :$advkickmsg2 - (Kick #$totalkicks)" }
  if {($advertisepunish == 2)} { putquick "MODE $chan +b $banmask"; putquick "KICK $chan $nick :$advkickmsg2 - (Kick #$totalkicks)"; timer 
$advertisebantime [list advertise:unban $banmask $chan] }
  if {($advertisepunish == 3)} { newchanban $chan $banmask advertise $advkickmsg $advertisebantime; putquick "KICK $chan $nick :$advkickmsg2 - 
(Kick #$totalkicks)" }
  if {($advertisepunish == 4)} { newban $banmask advertise $advkickmsg $advertisebantime; putquick "KICK $chan $nick :$advkickmsg2 - (Kick 
#$totalkicks)" }
  if {($advertisepunish != 1) && ($advertisepunish != 2) && ($advertisepunish != 3) && ($advertisepunish != 4)} { putlog "ADVERTISE PUNISHMENT: No punishment type selected."; return 0 }
}

proc advertise:kick:script {nick chan advertiseword advertisetype advertiseban} {
 global botnick advertisepunish advertisekicks advertisebantime
  set file [open $advertisekicks "r"]; set currentkicks [gets $file]; close $file; set totalkicks [expr $currentkicks]; set banmask $advertiseban
  set advertisemsg "2Advertise/Invite 12word 6\"$advertiseword\" 12detected. Mass 2Advertising/Inviting/Spamming 12in 12is not tolerated on this 2channel. 12Failing to 2comply 12with 2these rules 12will result into a 2permanent ban."
  if {($advertisebantime == 0) || ($advertisebantime == "") || ($advertisebantime < 1)} { set advertisebantime 60 }
  if {($advertisetype == "TEXT")} { set advertisescriptmsg "0,1 Channel Text Advertise Kick 12,0 - $advertisemsg" }; if {($advertisetype == "ACTION")} { set advertisescriptmsg "0,1 Channel Action Advertise Kick 12,0 - $advertisemsg" }; if {($advertisetype == "NOTICE")} { set advertisescriptmsg "0,1 Channel Notice Advertise Kick 12,0 - $advertisemsg" }
  if {($advertisepunish == 1)} { putquick "KICK $chan $nick :$advertisescriptmsg2 - (Kick #$totalkicks)" }
  if {($advertisepunish == 2)} { putquick "MODE $chan +b $banmask"; putquick "KICK $chan $nick :$advertisescriptmsg2 - (Kick #$totalkicks)"; timer 
$advertisebantime [list advertise:unban $banmask $chan] }
  if {($advertisepunish == 3)} { newchanban $chan $banmask advertise $advertisescriptmsg $advertisebantime; putserv "KICK $chan $nick :$advertisescriptmsg2 - (Kick #$totalkicks)" }
  if {($advertisepunish == 4)} { newban $banmask advertise $advkickmsg $advertisebantime; putserv "KICK $chan $nick :$advkickmsg2 - (Kick #$totalkicks)" }
  if {($advertisepunish != 1) && ($advertisepunish != 2) && ($advertisepunish != 3) && ($advertisepunish != 4)} { putlog "ADVERTISE PUNISHMENT: No punishment type selected."; return 0 }
}


proc advertise:banmask {uhost nick} {
 global advbanmask
   switch -- $advbanmask {
    1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
    2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    3 { set banmask "*!*$uhost" }
    4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
    5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" }
    6 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
    7 { set banmask "$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    8 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    9 { set banmask "$nick*!*@[lindex [split $uhost "@"] 1]" }
    10 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
    11 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
    12 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    13 { set banmask "*$nick*!*$uhost" }
    14 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
    15 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" } 
    16 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" } 
    17 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    18 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" } 
    19 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    20 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" } 
    default { set banmask "*!*@[lindex [split $uhost @] 1]" }
    return $banmask
   }
}

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


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

### Thanks to NeOmAtRiX for this kick counter ###
proc advertise:kick:counter {nick uhost handle chan target arg} {
 global botnick advertisekicks
  if {[string tolower $target] == [string tolower $botnick]} { return 0 }
  if {[string tolower $nick] == [string tolower $botnick]} {
   if {![file exists $advertisekicks]} {
    putlog "ADVERTISE KICK COUNTER: The advertise kick counter file does not exist. Creating file $advertisekicks."
    set file [open $advertisekicks "w"]
    puts $file 1; close $file 
    }
    set file [open $advertisekicks "r"]
    set currentkicks [gets $file]; close $file
    set file [open $advertisekicks "w"]
    puts $file [expr $currentkicks + 1]; close $file
    }
}


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


putlog "\[LOADED\] Channel Advertise/Spam Kicker v3.92.b by \002awyeah (awyeah@usa.net)\002"
if {($advertisetype == 1)} { putlog "Advertise/Spam Kicker is \002*ACTIVE*\002 on: \002$advertisechans\002" }
if {($advertisetype == 2)} { putlog "Advertise/Spam Kicker IS \002*ACTIVE*\002 on: \002All channels\002" }
if {(($advertiseactivate == 1) || ($advertiseactivate == 2) || ($advertiseactivate == 3) || ($advertiseactivate == 4)) && (($advertisetype != 1) && ($advertisetype != 2))} { putlog "Advertise/Spam Kicker is \002*NOT ACTIVE*\002 because: \002No *channel activation type* has been seletected\002" }
if {(($advertisetype == 1) || ($advertisetype == 2)) && (($advertiseactivate != 1) && ($advertiseactivate != 2) && ($advertiseactivate != 3) && ($advertiseactivate != 4))} { putlog "Advertise/Spam Kicker is \002*NOT ACTIVE*\002 because: \002No *channel interface* has been seletected\002" }
if {($advertisetype != 1) && ($advertisetype != 2) && ($advertiseactivate != 1) && ($advertiseactivate != 2) && ($advertiseactivate != 3) && ($advertiseactivate != 4)} { putlog "Advertise/Spam Kicker is \002*NOT ACTIVE*\002 because: \002No *channel activation type* and *channel interface* has been seletected\002" }

return


User avatar
qwek
Voice
Posts: 35
Joined: Tue Sep 21, 2004 7:51 am
Location: space

Post by qwek »

did you already changed the channel name?
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

yes

Post by dossi »

Yes, I configured the script to work on the channel "#test-a"
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Code: Select all

#Set the amount of time in minutes to ban the user for. (in mins) 
#(By default if you don't set a value the script will assume it to be 60 minutes) 
set advertisebantime "2"
If you have not set a value here then that is the possible cause of the error.

PS: Next time post in Script Support & Releases
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

hah, that line was commented out *oops*!

Sorry for the post, I should have saw that :oops:

PS: Will do.
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

Okay, it's banning now but it's not removing that ban.

I get this error:

Code: Select all

[03:17] Tcl error [pub:advertise]: wrong # args: should be "timer minutes command"
Hmm?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

wrap-around problem, those ultra long source lines ((tm) awyeah) with the [timer] command are cut by line breaks, which is a syntax error
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

Is there a quick fix for this, or do I have to go through and make sure everything is on one line?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Never encountered that problem before, nor got any email regarding that type of bug. Try using punishment option #3 instead of option #2.

/me sees most of the obsolete code and grunts to himself.
* Have to fix alot if idiotic things I put in it.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

From what demond said, I don't think it's a problem with your code, awyeah. :)

I think it's the one-line / word-wrap thing.

/me gets working on making everything one line
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

There is no coding or logic error as far as I can see, but a wrapping error maybe. If you use different editors, pico, vi or some others in Windows. When using pico, always try to use:
pico -w <filename>

instead of

pico <filename>
Yes you can do that just use a good text editor in UNIX format. Try and remove all the ";" semi-colons which join up most peices of code into long lines and after removing the semi-colon b/w each line, press ENTER and place that next piece of code in a new line.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

awyeah wrote:There is no coding or logic error as far as I can see, but a wrapping error maybe. If you use different editors, pico, vi or some others in Windows.

Yes you can do that just use a good text editor in UNIX format. Try and remove all the ";" semi-colons which join up most peices of code into long lines and after removing the semi-colon b/w each line, press ENTER and place that next piece of code in a new line.
the benefits of having nice code formatting habits will eventually come to your attention ;)

you can't go wrong with breaking lines before 80-th character (the width of most consoles) and using ';' for concatenating short statements only
d
dossi
Voice
Posts: 30
Joined: Mon Dec 20, 2004 9:21 pm

Post by dossi »

Will a text editor like EditPlus (for windows) work like pico so it doesn't cause the code to move to multiple lines?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

dossi wrote:Will a text editor like EditPlus (for windows) work like pico so it doesn't cause the code to move to multiple lines?
simply put each [timer] statement with its arguments on a new line, it doesn't matter what editor/operating system you use
Locked