From 4a6cd663cd42ace1e6094561a115fbd7879fd368 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 13 Oct 2023 21:17:50 +0300 Subject: [PATCH] make chud award work with marsify award --- files/helpers/marsify.py | 7 +++++++ files/helpers/sanitize.py | 4 ++-- files/routes/awards.py | 2 -- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/files/helpers/marsify.py b/files/helpers/marsify.py index 346c0ec48..6e731930c 100644 --- a/files/helpers/marsify.py +++ b/files/helpers/marsify.py @@ -1,6 +1,12 @@ 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 '
' in text or '' in text:
@@ -10,6 +16,7 @@ def marsify(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}: '
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index b82cd5683..f805e7a9a 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -379,7 +379,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
 	if obj and not (isinstance(obj, Post) and len(obj.body) > 1000):
 		if author.owoify:
 			sanitized = owoify(sanitized)
-		if author.marsify and not author.chud:
+		if author.marsify:
 			sanitized = marsify(sanitized)
 
 	if obj and obj.sharpened:
@@ -679,7 +679,7 @@ def filter_emojis_only(title, golden=True, count_emojis=False, obj=None, author=
 	if obj and not (isinstance(obj, Post) and len(obj.body) > 1000):
 		if author.owoify:
 			title = owoify(title)
-		if author.marsify and not author.chud:
+		if author.marsify:
 			title = marsify(title)
 
 	if obj and obj.sharpened:
diff --git a/files/routes/awards.py b/files/routes/awards.py
index 0c6d87e29..a6320f3a6 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -493,8 +493,6 @@ def award_thing(v, thing_type, id):
 	elif kind == "pride":
 		badge_grant(user=author, badge_id=303)
 	elif kind == 'marsify':
-		if author.chud:
-			abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
 		if not author.marsify or author.marsify != 1:
 			if author.marsify: author.marsify += 86400
 			else: author.marsify = int(time.time()) + 86400