#!/usr/bin/env python import es import psyco psyco.full() info = es.AddonInfo() info.name = "Anti-Swear Mod" info.version = "1.0" info.author = "sonicsight" info.url = "http://www.sonicsightz.com/" info.basename = "anti-swear" info.description = "Filters ALL chat messages for inapropriate word that you specify and replaces them with friendly words you specify." # below is where you would add more words if you want follow this example: ",'word':'replacment word'". Please only put the word in lowercase letters it will check for all versions of the upercase word. words = {'fuck':'f***','shit':'s***','ass':'a**','damn':'d***','bitch':'b****','basterd':'b******','whore':'w****','penis':'p****','vagina':'v*****','slut':'s***','sex':'s**','nigger':'n*****'} def load(): es.set("%s_version" % info.basename,info.version) es.makepublic("%s_version" % info.basename) es.msg("#multi","#green [%s]#default %s has loaded." % (info.basename,info.name)) es.addons.registerSayFilter(sayFilter) def unload(): es.msg("#multi","#green [%s]#default %s has unloaded." % (info.basename,info.name)) es.addons.unregisterSayFilter(sayFilter) def replaceWord(string,replace,new): while replace.lower() in string.lower(): spot = string.lower().index(replace.lower()) string = string[:spot]+new+string[spot+len(replace.lower()):] return string def sayFilter(userid,text,teamonly): for w in words: text = replaceWord(text,w,words[w]) return (userid,text,teamonly)