capitalization consistency

pull/211/head
Aevann 2023-09-29 04:29:14 +03:00
parent c70453e3d1
commit 0455ad4910
4 changed files with 15 additions and 15 deletions

View File

@ -4,9 +4,9 @@ from files.classes import Emoji, Sub
from files.helpers.config.const import *
SNAPPY_KONGS = []
marseys_const = []
marseys_const2 = []
marsey_mappings = {}
MARSEYS_CONST = []
MARSEYS_CONST2 = []
MARSEY_MAPPINGS = {}
SNAPPY_MARSEYS = []
SNAPPY_QUOTES = []
SNAPPY_QUOTES_FISTMAS = []
@ -14,19 +14,19 @@ SNAPPY_QUOTES_HOMOWEEN = []
STEALTH_HOLES = []
def const_initialize():
global marseys_const, marseys_const2, marsey_mappings, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES
global MARSEYS_CONST, MARSEYS_CONST2, MARSEY_MAPPINGS, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES
db = db_session()
marseys_const = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None, Emoji.name!='chudsey')]
marseys_const2 = marseys_const + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
MARSEYS_CONST = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None, Emoji.name!='chudsey')]
MARSEYS_CONST2 = MARSEYS_CONST + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
marseys = db.query(Emoji).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None).all()
for marsey in marseys:
for tag in marsey.tags.split():
if tag in marsey_mappings:
marsey_mappings[tag].append(marsey.name)
if tag in MARSEY_MAPPINGS:
MARSEY_MAPPINGS[tag].append(marsey.name)
else:
marsey_mappings[tag] = [marsey.name]
MARSEY_MAPPINGS[tag] = [marsey.name]
SNAPPY_KONGS = db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None).all()
SNAPPY_KONGS = [f':#{x[0]}:' for x in SNAPPY_KONGS]
@ -36,7 +36,7 @@ def const_initialize():
db.commit()
db.close()
SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2]
SNAPPY_MARSEYS = [f':#{x}:' for x in MARSEYS_CONST2]
try:
with open(f"snappy_{SITE_NAME}.txt", "r") as f:

View File

@ -1,6 +1,6 @@
from random import choice
from .const_stateful import marsey_mappings
from .const_stateful import MARSEY_MAPPINGS
def marsify(text):
if '`' in text or '<pre>' in text or '<code>' in text:
@ -10,7 +10,7 @@ def marsify(text):
for x in text.split(' '):
new_text += f'{x} '
x = x.lower()
if len(x) >= 5 and x in marsey_mappings:
marsey = choice(marsey_mappings[x])
if len(x) >= 5 and x in MARSEY_MAPPINGS:
marsey = choice(MARSEY_MAPPINGS[x])
new_text += f':{marsey}: '
return new_text

View File

@ -284,7 +284,7 @@ def render_emoji(html, regexp, golden, emojis_used, b=False, is_title=False):
attrs = ''
if b: attrs += ' b'
if is_title: emoji = emoji.replace('#','')
if golden and len(emojis) <= 20 and ('marsey' in emoji or emoji in marseys_const2):
if golden and len(emojis) <= 20 and ('marsey' in emoji or emoji in MARSEYS_CONST2):
if random.random() < 0.005:
attrs += ' ' + random.choice(('g', 'glow', 'party'))

View File

@ -302,7 +302,7 @@ def sign_up_post(v):
profileurl = None
if PFP_DEFAULT_MARSEY:
profileurl = '/e/' + random.choice(marseys_const) + '.webp'
profileurl = '/e/' + random.choice(MARSEYS_CONST) + '.webp'
new_user = User(
username=username,