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.

Bad phrase or word

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Arkadietz
Halfop
Posts: 67
Joined: Fri Jul 14, 2006 11:43 am
Location: cat /dev/zero > /dev/null;

Bad phrase or word

Post by Arkadietz »

Hi, there! I need a tcl where i can add my bad words or phrases. To support UTF && cp1251 (cyrlic).
To catch also words and phrases where is used /me
Also should has public and partyline commands like:

TO DO:
1. Public commands:
!addbw - add some phrase or word ( where they are stored in some file like badword.txt )
!rembw - remove some phrase or word
!showbw - show all added bad words or phrases

2. Partyline commands
Pretty much same like public
.addbw - add some phrase or word ( where they are stored in some file like badword.txt )
.rembw - remove some phrase or word
.showbw - show all added bad words or phrases

3. A specific flag for adding or remove bad words ( can be set only from perm owner )

4. Sets ban type:
# 1) *!*@some.domain.com
# 2) *!*@*.domain.com
# 3) *!*ident@some.domain.com
# 4) *!*ident@*.domain.com
# 5) Nick!*@*

5. Exempt: ( in tcl you can add nick or host eggdrop don't check exempts )
P.S Should don't check bots by default.


Example:
.addbw "bad word or phrase" reason for ban
.addbw "wanna [censored] ya?" please die!

6. Check for already exist words or phrases. If the words or phrase exist bot should back to you message like: The word or phrase already exist!
On a unix system everything is a file ; if something is not a file , it is a proccess.
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

Someone please make this tcl.
Somebody alive ?
Thank You
SmasHinG®
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

SmasHinG wrote:Someone please make this tcl.
Somebody alive ?
Thank You
Stop bumping the thread.... If someone wants to make this, they will. Otherwise, learn to code yourself and stop bothering everyone.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

And finally i have the mood for this script

Commands:
!badword -add word/phrase
!badword -del word/phrase
!badword -list
!badword ban-type 1/2/3/4/5
!badword -ban-reason REASON
It will be compatible with UTF-8 yet for cirilic i don`t know and im still guessing if it will work with utf-8 (i will use that fix script for utf-8 because i can`t compile on my server)

So im waiting for reply if you want it like this if not i won`t do it
User avatar
Arkadietz
Halfop
Posts: 67
Joined: Fri Jul 14, 2006 11:43 am
Location: cat /dev/zero > /dev/null;

Post by Arkadietz »

yeah i'm waiting for your code :)
On a unix system everything is a file ; if something is not a file , it is a proccess.
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

Madalin wrote:And finally i have the mood for this script

Commands:
!badword -add word/phrase
!badword -del word/phrase
!badword -list
!badword ban-type 1/2/3/4/5
!badword -ban-reason REASON
It will be compatible with UTF-8 yet for cirilic i don`t know and im still guessing if it will work with utf-8 (i will use that fix script for utf-8 because i can`t compile on my server)

So im waiting for reply if you want it like this if not i won`t do it
Okay Madalin give this code who you have and Thanks
SmasHinG®
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

If you want the script to work with UTF-8 you have 2 choices:

1. Recompile the eggdrop and read this http://eggwiki.org/Bugs/Utf-8 (you have to change an setting when you compile the eggdrop)

2. Load http://forum.egghelp.org/viewtopic.php? ... light=utf8 this script before the badwords script (it should work yet i recommand recompile)

Here is the script:

Code: Select all

#### ++++ Author: MadaliN <madalinmen28@yahoo.com
### ++++ Script name: Badwords
## ++++ Version: 1.0 (2/9/2013)
#
# Commands
#		!badwords on/off
#		!badwords ban-reason REASON
#		!badwords ban-type 1/2/3/4 (!badwords ban-type 1)
#		!badwords add WORD/PHRASE
#		!badwords del WORD/PHRASE
#		!badwords list

setudef flag badwords

bind PUB n !badwords badwords:pub

bind PUBM - * badwords:pubm

proc mh {nuhost type} {

	set user [lindex [split $nuhost !] 0]
	set host [lindex [split $nuhost !] 1]

	switch $type {
		1 {return $nuhost}
		2 {return *!*@$host}
		3 {return *!*$user@$host}
		4 {return *!*$user@*}
	}
}


proc badwords:pubm {nick uhost hand chan arg} {
	global badwords tempbw

	if {[channel get $chan badwords]} {
		foreach b [array names badwords $chan,*] {
			if {[string match -nocase "*[lindex [split $b ,] 1]*" $arg] && ![matchattr $hand n] && ![isop $nick $chan]} {

				if {![info exists tempbw($chan,ban-type)]} { set tempbw($chan,ban-type) 2 }
				if {![info exists tempbw($chan,reason)]} { set tempbw($chan,reason) "Hit the door ya ;" }

				newchanban $chan [mh $nick!$uhost $tempbw($chan,ban-type)] $nick $tempbw($chan,reason) 0

				putserv "KICK $chan $nick :$tempbw($chan,reason)"
			}
		}
	}
}

proc badwords:pub {nick uhost hand chan arg} {
	global badwords tempbw

	set what [join [lrange [split $arg] 1 end]]

	switch -exact -- [lindex [split $arg] 0] {
		ban-type -
		-ban-type {
			if {[lindex [split $arg] 1] == ""} { putserv "PRIVMSG $chan :\002$nick\002 - You have to specify ban-type (1/2/3/4)"; return }
			if {![regexp {^(1|2|3|4)$} [lindex [split $arg] 1]]} { putserv "PRIVMSG $chan :\002$nick\002 valid types are 1/2/3 or 4 (!badwords ban-type 2)"; return }

			set tempbw($chan,ban-type) $what
			badwords:save

			putserv "PRIVMSG $chan :\002$nick\002 - 'ban-type' has been SET"
		}
		-r -
		-reason {
			if {[lindex [split $arg] 1] == ""} { putserv "PRIVMSG $chan :\002$nick\002 - You have to specify ban-reason"; return }

			set tempbw($chan,reason) $what
			badwords:save

			putserv "PRIVMSG $chan :\002$nick\002 - 'ban-reason' has been SET"
		}
		on -
		-on {
			channel set $chan +badwords

			putserv "PRIVMSG $chan :\002$nick\002 - Succesfully activated \00303badwords\003 script on this channel"
		}
		off -
		-off {
			channel set $chan -badwords

			putserv "PRIVMSG $chan :\002$nick\002 - Succesfully deactivated \00303badwords\003 script on this channel"
		}
		add -
		-add {
			if {[info exists badwords($chan,$what)]} {
				putserv "PRIVMSG $chan :\002$nick\002 - '\00312$what\003' already exists in the database."
				return
			} else {
				set badwords($chan,$what) "[unixtime]"
				badwords:save

				putserv "PRIVMSG $chan :\002$nick\002 - Succesfully added '\00312$what\003' into the database."
				return
			}
		}
		del -
		-del {
			if {![info exists badwords($chan,$what)]} {
				putserv "PRIVMSG $chan :\002$nick\002 - '\00312$what\003' was not found in the database."
				return
			} else {
				unset -nocomplain badwords($chan,$what)
				badwords:save

				putserv "PRIVMSG $chan :\002$nick\002 - Succesfully removed '\00312$what\003' from the database."
				return
			}
		}
		list -
		-list {
			set temp(list) ""
			foreach b [array names badwords $chan,*] { lappend temp(list) [lindex [split $b ,] 1] }

			if {$temp(list) == ""} { putserv "PRIVMSG $chan :\002$nick\002 - Badwords database for \00303$chan\003 is \002empty\002"; return }

			putserv "PRIVMSG $chan :\002$nick\002 - Badwords: [join $temp(list) ", "]"
		}
		reset -
		-reset {
			foreach b [array names badwords $chan,*] {
				unset -nocomplain badwords($chan,[lindex [split $b ,] 1])
			}

			badwords:save
			putserv "PRIVMSG $chan :\002$nick\002 - Succesfully RESET badwords"
		}
	}
}

proc badwords:save {} {
	global badwords tempbw

	set ofile [open badwords w]
	puts $ofile "array set badwords [list [array get badwords]]"
	puts $ofile "array set tempbw [list [array get tempbw]]"
	close $ofile
}

catch {source badwords}


putlog "++++ Succesfully loaded: \00312Badwords TCL Script"

If any problems regarding the script please post here.
If someone tested the script please post so i know its ok.

Every channel can have its own database
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

To this script maybe missing check for already exist word/phrase. Can you make this ?
SmasHinG®
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Have you atleast tested the script ?

Have you seen
putserv "PRIVMSG $chan :\002$nick\002 - '\00312$what\003' already exists in the database."
??
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

Sorry my mistake :)
Catch /me tex ? in tcl ACTION i want catch pubmsg and action.
Make to work badwords cmds to pubmsg and dcc
Can you make for every bad word reason example: !badword [censored] you using bad word out !
example2: !badword somebad you are stupid to use this word
and etc.
SmasHinG®
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

How you can modify the code to add bad words by private message to BoT ?
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
M
Mariio1692
Voice
Posts: 5
Joined: Fri Feb 03, 2017 10:24 am
Location: students
Contact:

channel debug

Post by Mariio1692 »

Can you add words from the bot debug channel and the ifractor be expelled where the protection is active?
I love industrial engineering...
Post Reply