Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Stops the more popular foreign-language spam messages and sends the user a message reminding them to use English.
- By Influx
- """
- import string
- def apply_script(protocol, connection, config):
- class ktonolakConnection(connection):
- global langdict
- global langmessage
- # This is the dictionary. Add any other entries in here.
- langdict = {
- 'kto': 'Polish',
- 'polak': 'Polish',
- 'polski': 'Polish',
- 'ktopolak': 'Polish',
- 'ktoz': 'Polish',
- 'jestpolski': 'Polish',
- 'kurwa': 'Polish',
- 'alguem': 'Brazilian',
- 'br': 'Brazilian',
- 'brasileiro': 'Brazilian',
- 'alguembr': 'Brazilian',
- 'alguembrasileiro': 'Brazilian',
- 'jemand': 'German',
- 'deutsch': 'German',
- 'jemanddeutsch': 'German',
- 'deutscher': 'German'
- }
- #Thanks to Sample for the Polish translation
- #Thanks to ilplayde and EssigGurkenFred for the German translation
- #Thanks to xNyan for the Brazilian translation
- langmessage = {
- 'Polish': 'Jest to anglojezyczny Serwer, pisz po Angielsku prosze.',
- 'Brazilian': 'Este servidor tem como lingua principal a inglesa. Por favor, fale ingles.',
- 'German': 'Sie sind auf einem englischsprachigen Server. Kommunizieren Sie bitte auf Englisch.'
- }
- def on_chat(self, value, global_message):
- message = string.lower(value)
- for punc in string.punctuation:
- message = message.replace(punc,"")
- for x in string.split(message):
- if langdict.has_key(x):
- blockedlang = langdict[x]
- self.send_chat('%s' % langmessage[blockedlang])
- return False
- return connection.on_chat(self, value, global_message)
- return protocol, ktonolakConnection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement