This script looks for particular words in other languages and warns the user to speak English in their language.
It only works if they are not an operator, and the holder of this script is an operator.
This is fairly basic because it only looks for common greeting words, and only warns. I'd like to get it to kick on the 2nd offense.
It supports Spanish, Portugese, German, and Italian. Feel free to add more words/languages.
If you're finding you need this script a lot, you might want to include a !translate function. I am using mountaindew's Google Translator in case the bot does not recognize a word. Said script can be found here: http://www.hawkee.com/snippet/4103/
Please let me know if you're going to use it! I'd like to get a count if anyone will use.
Changelog
Regular Expressions
Script now uses Regular Expressions, also known as Regular Expressions. Allows for higher accuracy, but not fool proof.
Exact Identification
Script now looks for the exact word, and warns it. It used to say:
: Yes please : someone: Englisch sprechen, bitte.
Thank You Jethro_
on *:TEXT:*:#: {
var %spanish = /(\bhola\b|\bcomo\b|\bbuenos\b|\bestan\b|\bbuenas\b|\btardes\b|\bsi\b|\bnoches\b)$/iS
var %portugese = /(\bola\b|\bcomo\b|\bvai\b|\bvocê\b|\bbom\b|\bsim\b)$/iS
var %german = /(\bja\b|\bdanke\b|\bwie|\bgeht\b|\bes\b|\bdir\b|\bGuten\b|\bMorgen\b|\bnein\b|\bnicht\b)$/iS
var %italian = /(\bCiao\b|\bcome\b|\bstai\b|\bbuon\b|\bgiorno\b|\bpomeriggio\b|\bnotte\b|\bsalve\b|\bsera\b|\bsta\b|\bgrazie\b|\bcentiamo\b|\bbene\b)$/iS
;if ($nick !isop $chan) && ($me isop $chan)
{
if ($regex($1-,%spanish)) { msg $chan 4 $+ $nick $+ : 4Sólo hablan Inglés. 7[Spanish/Español] }
if ($regex($1-,%portugese)) { msg $chan 4 $+ $nick $+ : 4Por favor, fale Inglês. 7[Portugese/Português] }
if ($regex($1-,%german)) { msg $chan 4 $+ $nick $+ : 4Englisch sprechen, bitte. 7[German/Deutsch] }
if ($regex($1-,%italian)) { msg $chan 4 $+ $nick $+ : 4Si prega di parlare inglese. 7[Italian/Italiano] }
}
}
i have it loaded and not one error. people talk in my channel and nothing happens unless they talk in the language that is in the script. I like it. mini Cruzer would u allow me to add two warnings and a kickban on the third warning. And of course you will get credit on the main part of the script....
miniCruzer, add \b anchor to every of your regex matches like this:
/(\bbola\b|\bComo\b|\bvai\b|\bvocê\b|\bbom\b|\bsim\b)/iS
This will greatly minimize the chances of being triggered wrongly if any word or letter said within the matching text. And remove the dollar sign at the end of them.
I think it's rude and arrogant to laugh at people's scripts without giving his or her suggestion for improvement.
[22:42:41] <00Big_Boss> ignores opers
[22:42:41] <07&Helios> 4Big_Boss: 4Englisch sprechen, bitte. 7[German/Deutsch]
[22:37:19] <00Stevo127> You stupid bastard
[22:37:20] <07&Helios> 4Stevo127: 4Si prega di parlare inglese. 7[Italian/Italiano]
[22:25:24] <00Stevo127> Old mIRC version
[22:25:25] <07&Helios> 4Stevo127: 4Sólo hablan Inglés. 7[Spanish/Español]
[22:17:06] <00Stevo127> im tryin to get his attension
[22:17:07] <07&Helios> 4Stevo127: 4Sólo hablan Inglés. 7[Spanish/Español]
Your script has some drawbacks...if someone say yes or directory it will trigger the German warning...so will other languages if any English words consists of triggers in the regex matching range. I will add a $ symbol at the end to make sure it ends with that certain match, and your script can be combined using one text event, and @ symbol in the text event is an equivalent to if ($me isop #):
on @*:TEXT:*:#: {
var %spanish = /(hola|como|buenos|estan|buenas|tardes|si|noches)$/iS
var %portugese = /(ola|Como|vai|você|bom|sim)$/iS
var %german = /(ja|danke|wie|geht|es|dir|Guten|Morgen|nein|nicht)$/iS
var %italian = /(Ciao|come|stai|buon|giorno|pomeriggio|notte|salve|sera|sta|grazie|centiamo|bene)$/iS
if ($nick !isop $chan) {
if ($regex($1-,%spanish)) { .msg $chan 4 $+ $nick $+ : 4Sólo hablan Inglés. 7[Spanish/Español] }
if ($regex($1-,%portugese)) { .msg $chan 4 $+ $nick $+ : 4Por favor, fale Inglês. 7[Portugese/Português] }
if ($regex($1-,%german)) { msg $chan 4 $+ $nick $+ : 4Englisch sprechen, bitte. 7[German/Deutsch] }
if ($regex($1-,%italian)) { msg $chan 4 $+ $nick $+ : 4Si prega di parlare inglese. 7[Italian/Italiano] }
}
}
But it's still not 100% foolproof; the script can still get triggered on certain match by accident.
I added to each word a \b example var %Spanish = /(\bhola\b|\bcomo\b|\bbuenas\b|\btardes\b|\bsi\b|\bnoches\b)$/I$
and that seemed to take care of the problem of wrong words being detected. hope this helps