2022-11-15 09:19:08 +00:00
|
|
|
from os import path
|
|
|
|
|
2023-10-07 17:55:50 +00:00
|
|
|
from files.classes import Emoji, Hole
|
2023-03-12 13:03:58 +00:00
|
|
|
from files.helpers.config.const import *
|
2022-11-15 09:19:08 +00:00
|
|
|
|
2024-03-09 09:35:59 +00:00
|
|
|
if FEATURES['ART_SUBMISSIONS']:
|
|
|
|
from files.classes.art_submissions import ArtSubmission
|
|
|
|
|
2023-05-02 13:49:28 +00:00
|
|
|
SNAPPY_KONGS = []
|
2023-09-29 01:29:14 +00:00
|
|
|
MARSEYS_CONST = []
|
|
|
|
MARSEYS_CONST2 = []
|
|
|
|
MARSEY_MAPPINGS = {}
|
2023-05-02 13:49:28 +00:00
|
|
|
SNAPPY_MARSEYS = []
|
2022-11-15 09:19:08 +00:00
|
|
|
SNAPPY_QUOTES = []
|
2023-09-28 23:58:09 +00:00
|
|
|
SNAPPY_QUOTES_FISTMAS = []
|
|
|
|
SNAPPY_QUOTES_HOMOWEEN = []
|
2024-08-11 20:32:51 +00:00
|
|
|
STEALTH_HOLES = []
|
2023-12-25 01:18:48 +00:00
|
|
|
NSFW_EMOJIS = []
|
2024-02-29 18:02:04 +00:00
|
|
|
ALPHABET_MARSEYS = []
|
2024-03-09 09:35:59 +00:00
|
|
|
MIN_ART_ID_FOR_HQ = 999999999
|
2022-11-15 09:19:08 +00:00
|
|
|
|
2023-07-08 14:03:58 +00:00
|
|
|
def const_initialize():
|
2024-08-11 20:32:51 +00:00
|
|
|
global MARSEYS_CONST, MARSEYS_CONST2, MARSEY_MAPPINGS, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES, NSFW_EMOJIS, ALPHABET_MARSEYS, MIN_ART_ID_FOR_HQ
|
2023-03-16 06:27:58 +00:00
|
|
|
|
2023-07-08 14:03:58 +00:00
|
|
|
db = db_session()
|
|
|
|
|
2023-10-05 10:19:50 +00:00
|
|
|
MARSEYS_CONST = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind == "Marsey", Emoji.submitter_id == None, Emoji.name != 'chudsey', Emoji.nsfw == False)]
|
2024-02-29 18:02:04 +00:00
|
|
|
ALPHABET_MARSEYS = [x[0] for x in db.query(Emoji.name).filter_by(kind='Marsey Alphabet')]
|
|
|
|
MARSEYS_CONST2 = MARSEYS_CONST + ALPHABET_MARSEYS
|
2023-12-01 16:52:19 +00:00
|
|
|
|
2023-10-05 10:19:50 +00:00
|
|
|
marseys = db.query(Emoji).filter(Emoji.kind=="Marsey", Emoji.submitter_id == None, Emoji.nsfw == False).all()
|
2023-03-16 06:27:58 +00:00
|
|
|
for marsey in marseys:
|
|
|
|
for tag in marsey.tags.split():
|
2023-09-29 01:29:14 +00:00
|
|
|
if tag in MARSEY_MAPPINGS:
|
|
|
|
MARSEY_MAPPINGS[tag].append(marsey.name)
|
2023-03-16 06:27:58 +00:00
|
|
|
else:
|
2023-09-29 01:29:14 +00:00
|
|
|
MARSEY_MAPPINGS[tag] = [marsey.name]
|
2023-03-16 06:27:58 +00:00
|
|
|
|
2023-10-05 10:19:50 +00:00
|
|
|
SNAPPY_KONGS = db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None, Emoji.nsfw == False).all()
|
2023-09-28 23:58:09 +00:00
|
|
|
SNAPPY_KONGS = [f':#{x[0]}:' for x in SNAPPY_KONGS]
|
2023-04-25 17:02:56 +00:00
|
|
|
|
2024-08-11 20:32:51 +00:00
|
|
|
STEALTH_HOLES = {x[0] for x in db.query(Hole.name).filter(Hole.stealth == True, Hole.name != 'chudrama')}
|
2023-07-05 20:39:15 +00:00
|
|
|
|
2023-12-25 01:18:48 +00:00
|
|
|
NSFW_EMOJIS = [x[0] for x in db.query(Emoji.name).filter_by(nsfw=True)]
|
2023-09-29 07:15:29 +00:00
|
|
|
|
2024-03-09 09:35:59 +00:00
|
|
|
if FEATURES['ART_SUBMISSIONS']:
|
|
|
|
MIN_ART = db.query(ArtSubmission.id).order_by(ArtSubmission.id).first()
|
|
|
|
if MIN_ART: MIN_ART_ID_FOR_HQ = MIN_ART[0]
|
|
|
|
|
2023-05-16 05:29:42 +00:00
|
|
|
db.commit()
|
|
|
|
db.close()
|
|
|
|
|
2023-09-29 01:29:14 +00:00
|
|
|
SNAPPY_MARSEYS = [f':#{x}:' for x in MARSEYS_CONST2]
|
2023-05-05 21:45:25 +00:00
|
|
|
|
2023-03-16 06:27:58 +00:00
|
|
|
try:
|
2023-09-28 23:58:09 +00:00
|
|
|
with open(f"snappy_{SITE_NAME}.txt", "r") as f:
|
2024-02-11 10:17:02 +00:00
|
|
|
SNAPPY_QUOTES = f.read().strip().split("\n[para]\n")
|
2023-09-28 23:58:09 +00:00
|
|
|
with open(f"snappy_fistmas_{SITE_NAME}.txt", "r") as f:
|
2024-02-11 10:17:02 +00:00
|
|
|
SNAPPY_QUOTES_FISTMAS = f.read().strip().split("\n[para]\n")
|
2023-10-26 16:40:36 +00:00
|
|
|
with open(f"snappy_homoween_{SITE_NAME}.txt", "r") as f:
|
2024-02-11 10:17:02 +00:00
|
|
|
SNAPPY_QUOTES_HOMOWEEN = f.read().strip().split("\n[para]\n")
|
2023-03-16 06:27:58 +00:00
|
|
|
except FileNotFoundError:
|
|
|
|
pass
|