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.

Looking for a special word ban/kick script

Old posts that have not been replied to for several years.
Locked
T
TRaSH
Halfop
Posts: 56
Joined: Wed Feb 26, 2003 3:38 pm
Location: #Anime-Supreme

Looking for a special word ban/kick script

Post by TRaSH »

I'm looking for a word ban/kick script that has the option to use different reasons for typing or showing certain words,
but it has to be configurable by me.
so if you type a certain word you get a special reason why
and for another word you see another reasons why.
Hope you understand what i mean.
i already checked the archive but i didn't really find a script that had this option
s
serra
Voice
Posts: 17
Joined: Sat Feb 22, 2003 10:24 pm

Post by serra »

hi,

so.. why don't you try coding it yourself?
there's a lot of ways to do that i woud suggest two:

One is using files or some sql db to store the words and the message for each word.
Then, add a bind pubm - * in your tcl and wile reading "word" from the file, check if the argument matches that word (ex: if [string match $word $arg]). if this returns 1, then send the message to the user.

if using files the data could be stored like this:
word1;message for word 1
word2;message for word 2
etc

to avoid beeing constantly opening reading and closing the file, you can read the file once and keep all in memory, in a list for example. Or directely set the list of words and messages:

set bla {
{
"word1"
"message for word 1"
}
{
"word2"
"message for word 2"
}
}

than you can access each element of this "list of lists":
[lindex [lindex $bla 0] 0] == word1
[lindex [lindex $bla 0] 1] == message for word 1
[lindex [lindex $bla 1] 0] == word2
[lindex [lindex $bla 1] 1] == message for word 2

that's it
pedro

PS: this might have errors, actuay i'm not very used to work in TCL, in C this was much more simple :p
T
TRaSH
Halfop
Posts: 56
Joined: Wed Feb 26, 2003 3:38 pm
Location: #Anime-Supreme

Post by TRaSH »

If i could i would :-?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Heh, at least try a bit and use the instructions you've recived and you'll get more. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Yourname
Master
Posts: 358
Joined: Mon Sep 24, 2001 8:00 pm
Location: Toronto

Post by Yourname »

If only everyone was a programmer with a programming mind *sigh* :(

I get so many brainy ideas, only I can't code.
Dormant egghead.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

however...

Post by De Kus »

a script like this exists. i dunno where i have it from, but here it is:

Code: Select all

##########################################################################
#
# WordKick v1.50 by ccr/TNSP <ccr@tnsp.org>
# Based on original wordkick.tcl by Goblet <goblet@goblet.net>
#
##########################################################################

# Configure these as you like

## Kickword mask/message file
# (FORMAT: See the example file!)
set wc_badword_file "data.wordkick"


## "Random happy-joy-joy-messages file"
# (FORMAT: One message per line)
set wc_happy_msg_file "data.happymsg"


## Gentle mode:
# 0 = Kick with kickmessage, say happymsg just before kicking
# 1 = Don't kick, just say happymsg.
set wc_gentlemode 0

## Irritation treshold mode:
# 0 = Normal, immendiate kick on detected kickword.
# 1 = Irritation tresholded kick. See README.
set wc_irritationmode 0

# Treshold of irritation. If this many kickwords are said
# fast enough, bot starts kicking.
set wc_irritationtreshold 1

# Preferred message type ("PRIVMSG" and "NOTICE")
set wc_preferredmsg "NOTICE"


##########################################################################
# No need to look below this line
##########################################################################
set wc_message "WordKick v1.50 by ccr/TNSP & Goblet"
set wc_name "WKick"

###
### Read the bad-word file
###
catch {unset wc_bad_mask_list}
catch {unset wc_kick_msg_list}
set wc_badword_max 0
set fd [open $wc_badword_file r]
   while {![eof $fd]} {
          gets $fd foo
          if {[string first # $foo] && ([lindex $foo 0] != "")} {
              set foo [split $foo "$"]
              lappend wc_bad_mask_list [lindex $foo 0]
              lappend wc_kick_msg_list [lrange $foo 1 end]
              incr wc_badword_max
              }
         }
close $fd


###
### Read the happy-message file
###
set wc_happy_msg_max 0
catch {unset wc_happy_msg_list}
set fd [open $wc_happy_msg_file r]
   while {![eof $fd]} {
          gets $fd foo
              lappend wc_happy_msg_list $foo
	      incr wc_happy_msg_max
         }
close $fd


###
### Initialize the script
###
bind time - "* % % % %" wc_timer
bind pubm - %* wc_check
bind ctcp - ACTION wc_check

putlog "$wc_message"
putlog "(maskfile: $wc_badword_file, $wc_badword_max // happymsg: $wc_happy_msg_file, $wc_happy_msg_max)"
if {$wc_irritationmode} {
putlog "(irritation mode, treshold: $wc_irritationtreshold)" 
} else {
putlog "(normal wordkick mode)"
}

catch {unset wc_irritation}
set wc_irritation 0

###
### Change the irritation
###
proc wc_timer {umin uhour uday umonth uyear} {
global wc_irritation
if {$wc_irritation > 0} {
	set wc_irritation [expr $wc_irritation - 1]
	}
}


###
### Match the messages with bad-word list
###
proc wc_check {nick uhost hand chan args} {
 global wc_bad_mask_list wc_kick_msg_list botnick wc_preferredmsg
 global wc_happy_msg_list wc_happy_msg_max wc_name wc_gentlemode
 global wc_irritation wc_irritationmode wc_irritationtreshold

# Convert to lower case
 set args [string tolower $args]

# Go through the sentence
 set kickit 0
 set x 0
 foreach foo $wc_bad_mask_list {
	set foo2 [split $foo "|"]

	foreach i $foo2 {
	if {[string match $i $args]} {
		putlog "$wc_name: $nick@$chan said a bad thing: $i"
		
		if {[matchattr $hand "f" $chan]} { return 0 }

# Say happymsg
#		if {[rand 100] > 40} {
		putserv "$wc_preferredmsg $chan :$nick, [lindex $wc_happy_msg_list [rand $wc_happy_msg_max]]"
#			}

# Check for gentle-mode
		if {$wc_gentlemode || [matchattr $hand j]} { return 0 }
		

# Check for irritation mode
		if {$wc_irritationmode} {
			if {$wc_irritation > $wc_irritationtreshold} {
				set kickit 1
				} else {
				incr wc_irritation
				}
			} else {
			set kickit 1
			}

# Kick the lamer
		if {$kickit} {
			putkick $chan $nick Badword Autokick ([lindex $wc_kick_msg_list $x]), Warnung -$x-
			return 0
			}

		}
	}

 incr x
 }
}
example for the 2 data. files:

Code: Select all

hentai nur jugendfreie Inhalte
fick schlecher Umgang
[censored] schlecher Umgang
nigger schlecher Umgang
porn nur jugendfreie Inhalte
p0rn nur jugendfreie Inhalte
pr0n nur jugendfreie Inhalte
warez keine illegale Software
crack keine illegale Software
arschloch schlecher Umgang
asshole schlecher Umgang
wixer schlecher Umgang
hure schlecher Umgang
nutte schlecher Umgang
bitch schlecher Umgang
Techno.gegen.Hiphop Execess Advertising

Code: Select all

lalalalala, ich liebe solche Worte.
Du hast einen Umgangston hier, tztztz.
man oh man, das war Dumm...
Hau... ruck! Und noch einer weniger.
PAAAARTYYYYY!!! und du fliegst...
this script worked, but seems it has problems with the kick reason, i didn't investigate it so long.
but perhaps the problem was only, the user alway singoff after spamming...

PS: the 4 stars are of course not in my files, it is called f-u-c-k :D.
Locked