forked from rDrama/rDrama
1
0
Fork 0
retarD/files/helpers/marsify.py

24 lines
522 B
Python

from random import choice
from .const_stateful import MARSEY_MAPPINGS
from .config.const import *
chud_words = set()
for phrase in CHUD_PHRASES:
chud_words.update(phrase.lower().split())
def marsify(text):
if '`' in text or '<pre>' in text or '<code>' in text:
return text
new_text = ''
for x in text.split(' '):
new_text += f'{x} '
x = x.lower()
if x in chud_words: continue
if len(x) >= 5 and x in MARSEY_MAPPINGS:
marsey = choice(MARSEY_MAPPINGS[x])
new_text += f':{marsey}: '
return new_text