Advertisement
Guest User

Untitled

a guest
Apr 9th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import string
  2.  
  3. def apply_script(protocol, connection, config):
  4.  
  5. class antiswearConnection(connection):
  6. global sweardict
  7.  
  8. sweardict = [
  9. 'duck',
  10. 'shit',
  11. 'bitch',
  12. 'bastard',
  13. 'fucking',
  14. 'penis',
  15. 'deuce',
  16. 'deuce',
  17. 'asshole',
  18. 'dick',
  19. ]
  20.  
  21. def on_chat(self, value, global_message):
  22. message = string.lower(value)
  23. for punc in string.punctuation:
  24. message = message.replace(punc,"")
  25. if any(swears in message for swears in sweardict):
  26. self.send_chat('Your message has been blocked. Please do not swear in this server.')
  27. return False
  28. return connection.on_chat(self, value, global_message)
  29.  
  30. return protocol, antiswearConnection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement