Badwords detection engine

By Someus on Oct 15, 2011


I was looking for badwords engine but couldnt find just engine snippet of badwords! So i made it for you! :) This is very very simple badwords detection engine! Engine uses text file to compare users entered text! If badword matches then... well your choice :) This is just a core! You can improve it! :) All you have to do is to create a text file called badwords.txt. In every line add a single badword! Thats it!

;On text entry variable saves entered text and
;passes it to alias engine to check if it is bad word!
on *:TEXT:*:#: { 
  set %text $1-
  set %s 1
;Checks if it is bad word using while loop as 
;many times as lines containing badwords in your text file
alias badword {
;Looks how many lines is in your text file
  set %lines $lines(badwords.txt)
  while ( %s <= %lines ) {
    if ($read(badwords.txt, %s ) isin %text ) {
      ; You command here :) For example:  msg # Jesus don`t like your language $nick ! :)
      unset %s
    else inc %s


Sign in to comment.
Jethro   -  Oct 16, 2011

Frenetic, a little socket script can be written to fetch that list.txt page at that link you've posted and match the bad words. :P Then that'll make it a good socket kicker. ^^

Someus   -  Oct 16, 2011

Thanks for suggestions :) Thanks for list of badwords Frenetic :)

gooshie   -  Oct 15, 2011

Thanks for that list. Now I can script a word replace.
(Actually already did that long ago, lol.)

Jethro   -  Oct 15, 2011

A quick workaround is to add the -l switch after the /set command as: set -l %variables
The -l switch is interchangeable with the /var command. The only difference is that with /var you can separate one variable after another with a comma; they both treat a variable as local.

Firstmate   -  Oct 15, 2011

A couple of things, the major being removing all these global variables.

You can do that with something like:

on *:TEXT:*:#: { 
  badword $1-

And later use it as such in the alias like:

alias badword {
;Looks how many lines is in your text file
  var %lines $lines(badwords.txt)
  var %s 1
  while ( %s <= %lines ) {
    if ($read(badwords.txt, %s ) isin $1-) {
    ;....continue code

What I'm really trying to suggest is your usage of global versus local variables (/set versus /var).

Hope that helps!

Jethro   -  Oct 15, 2011

If this is only for one event, you can save yourself an alias. Why all the global variables and the else statement? This is a lot cleaner and easier to look at:

on *:TEXT:*:#:{ 
  var %s = 1, %f = badwords.txt
  while (%s <= $lines(%f)) {
    if ($read(%f,n,%s) isin $1-) {
      ; your command here
    inc %s
NoStRuM  -  Jan 02, 2014

There may be one that also has a message tag before the ban, for example to read the line. Txt and that if a usuer types a lienea him a warning and if you type another line badword.txt him one last warning before the bankick.
Thank you in advance and happy new year
P.D: Written from the google translator.

Sign in to comment

alabama   -  Oct 15, 2011



Frenetic   -  Oct 15, 2011

One second, adding a link to a list of "bad" words.

Okay you can download it by right clicking > save as/save link as > blah:

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.