make the chance of snappy marseys and snappy quotes even

instead of being dependant on the number of each
master
Aevann1 2022-08-15 07:10:15 +02:00
parent c619204ec0
commit 9176a7746a
2 changed files with 13 additions and 10 deletions

View File

@ -43,10 +43,16 @@ def execute_snappy(post, v):
elif v.id == LAWLZ_ID:
if random.random() < 0.5: body = "wow, this lawlzpost sucks!"
else: body = "wow, a good lawlzpost for once!"
elif len(SNAPPY_QUOTES) == 0:
elif not SNAPPY_MARSEYS and not SNAPPY_QUOTES:
body = ""
else:
body = random.choice(SNAPPY_QUOTES).strip()
if SNAPPY_MARSEYS and SNAPPY_QUOTES:
if random.random() < 0.5: SNAPPY_CHOICES = SNAPPY_MARSEYS
else: SNAPPY_CHOICES = SNAPPY_QUOTES
elif SNAPPY_MARSEYS: SNAPPY_CHOICES = SNAPPY_MARSEYS
elif SNAPPY_QUOTES: SNAPPY_CHOICES = SNAPPY_QUOTES
body = random.choice(SNAPPY_CHOICES).strip()
if body.startswith(''):
body = body[1:]
vote = Vote(user_id=SNAPPY_ID,

View File

@ -917,15 +917,12 @@ marseys_const = [x[0] for x in db.query(Marsey.name).filter(Marsey.name!='chudse
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']
db.close()
SNAPPY_QUOTES = []
if not SITE_NAME in ['PCM', 'LGBDropTheT']:
SNAPPY_QUOTES = [f':#{x}:' for x in marseys_const2]
if SITE_NAME not in ('PCM', 'LGBDropTheT'):
SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2]
snappy_name = SITE_NAME
if path.isfile(f'snappy_{snappy_name}.txt'):
with open(f'snappy_{snappy_name}.txt', "r", encoding="utf-8") as f:
SNAPPY_QUOTES += f.read().split("\n{[para]}\n")
if path.isfile(f'snappy_{SITE_NAME}.txt'):
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
SNAPPY_QUOTES = f.read().split("\n{[para]}\n")
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()