better DKD snappy system
parent
a81cfb9415
commit
973ce26b7a
|
@ -75,15 +75,18 @@ def execute_snappy(post:Submission, v:User):
|
|||
else: body = "wow, a good lawlzpost for once!"
|
||||
else:
|
||||
if IS_DKD():
|
||||
SNAPPY_CHOICES = SNAPPY_EMOJIS
|
||||
elif SNAPPY_EMOJIS and SNAPPY_QUOTES:
|
||||
SNAPPY_CHOICES = SNAPPY_KONGS
|
||||
elif SNAPPY_MARSEYS and SNAPPY_QUOTES:
|
||||
if IS_FISTMAS() or random.random() > 0.5:
|
||||
SNAPPY_CHOICES = SNAPPY_QUOTES
|
||||
else:
|
||||
SNAPPY_CHOICES = SNAPPY_EMOJIS
|
||||
elif SNAPPY_EMOJIS: SNAPPY_CHOICES = SNAPPY_EMOJIS
|
||||
elif SNAPPY_QUOTES: SNAPPY_CHOICES = SNAPPY_QUOTES
|
||||
else: SNAPPY_CHOICES = [""]
|
||||
SNAPPY_CHOICES = SNAPPY_MARSEYS
|
||||
elif SNAPPY_MARSEYS:
|
||||
SNAPPY_CHOICES = SNAPPY_MARSEYS
|
||||
elif SNAPPY_QUOTES:
|
||||
SNAPPY_CHOICES = SNAPPY_QUOTES
|
||||
else:
|
||||
SNAPPY_CHOICES = [""]
|
||||
|
||||
body = random.choice(SNAPPY_CHOICES).strip()
|
||||
if body.startswith('▼') or body.startswith(':#marseydownvote'):
|
||||
|
|
|
@ -5,11 +5,11 @@ from sqlalchemy.orm import scoped_session
|
|||
from files.classes import Emoji
|
||||
from files.helpers.config.const import *
|
||||
|
||||
dk_const = []
|
||||
SNAPPY_KONGS = []
|
||||
marseys_const = []
|
||||
marseys_const2 = []
|
||||
marsey_mappings = {}
|
||||
SNAPPY_EMOJIS = []
|
||||
SNAPPY_MARSEYS = []
|
||||
SNAPPY_QUOTES = []
|
||||
|
||||
def const_initialize(db:scoped_session):
|
||||
|
@ -17,7 +17,7 @@ def const_initialize(db:scoped_session):
|
|||
_initialize_snappy_marseys_and_quotes()
|
||||
|
||||
def _initialize_marseys(db:scoped_session):
|
||||
global marseys_const, marseys_const2, marsey_mappings, dk_const
|
||||
global marseys_const, marseys_const2, marsey_mappings, SNAPPY_KONGS
|
||||
marseys_const = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None, Emoji.name!='chudsey').all()]
|
||||
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()
|
||||
|
@ -29,16 +29,14 @@ def _initialize_marseys(db:scoped_session):
|
|||
marsey_mappings[tag] = [marsey.name]
|
||||
|
||||
if IS_DKD():
|
||||
dk_const = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None).all()]
|
||||
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]
|
||||
|
||||
|
||||
def _initialize_snappy_marseys_and_quotes():
|
||||
global SNAPPY_EMOJIS, SNAPPY_QUOTES
|
||||
global SNAPPY_MARSEYS, SNAPPY_QUOTES
|
||||
|
||||
if IS_DKD():
|
||||
SNAPPY_EMOJIS = [f':#{x}:' for x in dk_const]
|
||||
else:
|
||||
SNAPPY_EMOJIS = [f':#{x}:' for x in marseys_const2]
|
||||
SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2]
|
||||
|
||||
if IS_FISTMAS():
|
||||
filename = f"snappy_fistmas_{SITE_NAME}.txt"
|
||||
|
|
Loading…
Reference in New Issue