this is a script that will auto ban someone if they use a certain word
where is says word1 word2 and word3 u can change to whatever word u want the bot to ban someone on and when they say the word set it will ban and kick them
on $*:text:/(word1|word2|word3)/Si:#:{
ban -ku900 $chan $address($nick,2)
kick $chan $nick 4(automatic 15 min ban)we dont use that word here now GTFO
}
Why not make an INI file that allows you to add the words to? This will make adding TONS of words easier. So, in an ini file, you have it laid out as:
[words]
badword=kick
badderword=kick,ban
Etc. You could set the option to kick and ban the users, just kick, warn, etc, depending on the level. Then, all you need is a loop to scan and make sure that the word is not in the file. You would want to load the INI into an active hash so that way scanning is easier. Anyways, just my 2 cents ;)
The way you have it, for instance:> blah blah blah word1 blah <- This won't trigger.
word1 <- this will trigger, but on a one-word basis. In other words, it'll trigger when nothing attaches to or follows it.
Take out the ^ and $ so the bad words will be matched in a sentence.
It's ok if you need to watch out for a few bad words using the on text regex approach. It's not recommendable if you want to look out for more bad words or add or delete more of them.
The best method I've known is using a hash table and
$hfind(badwords,$strip($1-),1,w).data
to match against words added in it. You can also use the -r switch for regex. word1|word2|word3|etc.. to be stored in hash table's data.
I won't go into detail of the hash table if you don't know about it. Read up on it at your leisure.
Since you've used the ^ caret and $ symbol, it'll mean that every bad word has to be masked in the beginning of a sentence and ends as it is. In other words, this code won't trigger if those bad words of your choice are scolded within a sentence.
P.S. you can shorten your kick/ban operation as such:
ban -ku900 # $nick 2 4(automatic 15 min ban)we dont use that word here now GTFO
, which does the exactly same thing as yours. You should also make sure the client running the code is opped in channel by prefixing @ to the text event. You don't want mIRC to return an error if it's not opped before kicking/banning. > on @$*:text: