2024-02-21 20:08:33 +00:00
|
|
|
import random
|
2022-08-27 02:57:19 +00:00
|
|
|
|
2023-09-29 01:29:14 +00:00
|
|
|
from .const_stateful import MARSEY_MAPPINGS
|
2023-10-13 18:17:50 +00:00
|
|
|
|
|
|
|
|
2023-10-13 18:49:21 +00:00
|
|
|
def marsify(text, chud_phrase):
|
2023-08-15 20:17:41 +00:00
|
|
|
if '`' in text or '<pre>' in text or '<code>' in text:
|
|
|
|
return text
|
|
|
|
|
2023-10-13 18:49:21 +00:00
|
|
|
chud_words = chud_phrase.split() if chud_phrase else []
|
|
|
|
|
2022-08-30 12:11:05 +00:00
|
|
|
new_text = ''
|
|
|
|
for x in text.split(' '):
|
|
|
|
new_text += f'{x} '
|
2022-09-01 22:38:33 +00:00
|
|
|
x = x.lower()
|
2023-10-13 18:17:50 +00:00
|
|
|
if x in chud_words: continue
|
2023-09-29 01:29:14 +00:00
|
|
|
if len(x) >= 5 and x in MARSEY_MAPPINGS:
|
2024-02-21 20:08:33 +00:00
|
|
|
marsey = random.choice(MARSEY_MAPPINGS[x])
|
2022-08-30 12:11:05 +00:00
|
|
|
new_text += f':{marsey}: '
|
2022-09-29 05:43:29 +00:00
|
|
|
return new_text
|