forked from MarseyWorld/MarseyWorld
LGB: Disable Snappy Marseys; Snappy empty behavior.
parent
bf386fa9fe
commit
16125b419b
|
@ -7,13 +7,6 @@ from files.helpers.sanitize import *
|
||||||
import random
|
import random
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
if SITE_NAME == 'PCM': snappyquotes = []
|
|
||||||
else: snappyquotes = [f':#{x}:' for x in marseys_const2]
|
|
||||||
|
|
||||||
if path.exists(f'snappy_{SITE_NAME}.txt'):
|
|
||||||
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
|
|
||||||
snappyquotes += f.read().split("\n{[para]}\n")
|
|
||||||
|
|
||||||
def badge_grant(user, badge_id, description=None, url=None):
|
def badge_grant(user, badge_id, description=None, url=None):
|
||||||
assert user != None
|
assert user != None
|
||||||
if user.has_badge(badge_id):
|
if user.has_badge(badge_id):
|
||||||
|
@ -49,8 +42,10 @@ def execute_snappy(post, v):
|
||||||
elif v.id == LAWLZ_ID:
|
elif v.id == LAWLZ_ID:
|
||||||
if random.random() < 0.5: body = "wow, this lawlzpost sucks!"
|
if random.random() < 0.5: body = "wow, this lawlzpost sucks!"
|
||||||
else: body = "wow, a good lawlzpost for once!"
|
else: body = "wow, a good lawlzpost for once!"
|
||||||
|
elif len(SNAPPY_QUOTES) == 0:
|
||||||
|
body = ""
|
||||||
else:
|
else:
|
||||||
body = random.choice(snappyquotes).strip()
|
body = random.choice(SNAPPY_QUOTES).strip()
|
||||||
if body.startswith('▼'):
|
if body.startswith('▼'):
|
||||||
body = body[1:]
|
body = body[1:]
|
||||||
vote = Vote(user_id=SNAPPY_ID,
|
vote = Vote(user_id=SNAPPY_ID,
|
||||||
|
@ -122,9 +117,11 @@ def execute_snappy(post, v):
|
||||||
gevent.spawn(archiveorg, href)
|
gevent.spawn(archiveorg, href)
|
||||||
|
|
||||||
body = body.strip()
|
body = body.strip()
|
||||||
|
|
||||||
body_html = sanitize(body)
|
body_html = sanitize(body)
|
||||||
|
|
||||||
|
if len(body_html) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
if len(body_html) < 40000:
|
if len(body_html) < 40000:
|
||||||
c = Comment(author_id=SNAPPY_ID,
|
c = Comment(author_id=SNAPPY_ID,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
|
@ -156,4 +153,4 @@ def execute_snappy(post, v):
|
||||||
c.top_comment_id = c.id
|
c.top_comment_id = c.id
|
||||||
|
|
||||||
post.comment_count += 1
|
post.comment_count += 1
|
||||||
post.replies = [c]
|
post.replies = [c]
|
||||||
|
|
|
@ -859,6 +859,14 @@ 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']
|
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()
|
db.close()
|
||||||
|
|
||||||
|
SNAPPY_QUOTES = []
|
||||||
|
if not SITE_NAME in ['PCM', 'LGBDropTheT']:
|
||||||
|
SNAPPY_QUOTES = [f':#{x}:' for x in marseys_const2]
|
||||||
|
|
||||||
|
if path.exists(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()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
||||||
|
|
||||||
ADMIGGERS = (37696,37697,37749,37833,37838,39413)
|
ADMIGGERS = (37696,37697,37749,37833,37838,39413)
|
||||||
|
|
Loading…
Reference in New Issue