SHARE
TWEET

Untitled

a guest Sep 20th, 2012 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2. Stops the more popular foreign-language spam messages and sends the user a message reminding them to use English.
  3.  
  4. By Influx
  5.  
  6. """
  7.  
  8. import string
  9.  
  10. def apply_script(protocol, connection, config):
  11.  
  12.     class ktonolakConnection(connection):
  13.         global langdict
  14.         global langmessage
  15.  
  16. # This is the dictionary. Add any other entries in here.
  17.         langdict = {
  18. 'kto': 'Polish',
  19. 'polak': 'Polish',
  20. 'polski': 'Polish',
  21. 'ktopolak': 'Polish',
  22. 'ktoz': 'Polish',
  23. 'jestpolski': 'Polish',
  24. 'kurwa': 'Polish',
  25. 'alguem': 'Brazilian',
  26. 'br': 'Brazilian',
  27. 'brasileiro': 'Brazilian',
  28. 'alguembr': 'Brazilian',
  29. 'alguembrasileiro': 'Brazilian',
  30. 'jemand': 'German',
  31. 'deutsch': 'German',
  32. 'jemanddeutsch': 'German',
  33. 'deutscher': 'German'
  34.  
  35. }
  36.  
  37. #Thanks to Sample for the Polish translation
  38. #Thanks to ilplayde and EssigGurkenFred for the German translation
  39. #Thanks to xNyan for the Brazilian translation
  40.  
  41.         langmessage = {
  42. 'Polish': 'Jest to anglojezyczny Serwer, pisz po Angielsku prosze.',
  43. 'Brazilian': 'Este servidor tem como lingua principal a inglesa. Por favor, fale ingles.',
  44. 'German': 'Sie sind auf einem englischsprachigen Server. Kommunizieren Sie bitte auf Englisch.'
  45. }
  46.  
  47.         def on_chat(self, value, global_message):
  48.             message = string.lower(value)
  49.             for punc in string.punctuation:
  50.                 message = message.replace(punc,"")
  51.             for x in string.split(message):
  52.                 if langdict.has_key(x):
  53.                     blockedlang = langdict[x]
  54.                     self.send_chat('%s' % langmessage[blockedlang])
  55.                     return False
  56.             return connection.on_chat(self, value, global_message)
  57.  
  58.     return protocol, ktonolakConnection
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top