import time
from better_profanity import profanity

# Load the default profanity wordlist
profanity.load_censor_words()

# Add custom profanity words
custom_profanities = ['profanity1', 'profanity2', 'profanity3', 'fuckk']  # replace with your own list
profanity.add_censor_words(custom_profanities)

def main():
    while True:
        with open('leaderboard.txt', 'r') as file:
            text = file.read()
        filtered_text = profanity.censor(text, '####')
        if filtered_text != text:
            with open('leaderboard.txt', 'w') as file:
                file.write(filtered_text)
            print("Filtered profanity from the file.")
        time.sleep(1)  # wait for 1 second before checking the file again

if __name__ == "__main__":
    main()
