events: add extension point for snappy quotes

pull/79/head
justcool393 2022-12-15 17:37:22 -06:00 committed by geese_suck
parent 0505989f49
commit 3d818f61e5
Signed by: geese_suck
GPG Key ID: 4D09E4B0A7264746
1 changed files with 8 additions and 3 deletions

View File

@ -3,7 +3,7 @@ from os import path
from sqlalchemy.orm import scoped_session
from files.classes import Marsey
from files.helpers.config.const import SITE_NAME
from files.helpers.config.const import HOLIDAY_EVENT, SITE_NAME
marseys_const = []
marseys_const2 = []
@ -32,6 +32,11 @@ def _initialize_snappy_marseys_and_quotes():
if SITE_NAME != 'PCM':
SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2]
if path.isfile(f'snappy_{SITE_NAME}.txt'):
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
filename = f"snappy_{SITE_NAME}.txt"
if HOLIDAY_EVENT: filename = f"snappy_event_{SITE_NAME}.txt"
try:
with open(filename, "r", encoding="utf-8") as f:
SNAPPY_QUOTES = f.read().split("\n{[para]}\n")
except FileNotFoundError:
pass