From 53a8818f8098d994d3fc83d82ba137794481a3b1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 13 Jun 2022 19:30:04 +0200 Subject: [PATCH] fix snappy gambling --- files/routes/posts.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index ff515a0ea..fe3b54166 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1160,8 +1160,8 @@ def submit_post(v, sub=None): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) + snappy = g.db.query(User).get(SNAPPY_ID) - if not (post.sub and g.db.query(Exile.user_id).filter_by(user_id=SNAPPY_ID, sub=post.sub).one_or_none()): if post.sub == 'dankchristianmemes': body = random.choice(christian_emojis) @@ -1172,7 +1172,7 @@ def submit_post(v, sub=None): if random.random() < 0.5: body = "wow, this lawlzpost sucks!" else: body = "wow, a good lawlzpost for once!" else: - body = random.choice(snappyquotes) + body = random.choice(snappyquotes).strip() if body.startswith('▼'): body = body[1:] vote = Vote(user_id=SNAPPY_ID, @@ -1197,7 +1197,8 @@ def submit_post(v, sub=None): ) g.db.add(vote) post.upvotes += 1 - + elif body == '!slots': + body = f'!slots{snappy.coins}' body += "\n\n" @@ -1239,11 +1240,6 @@ def submit_post(v, sub=None): body += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n' gevent.spawn(archiveorg, href) - snappy = g.db.query(User).filter_by(id = SNAPPY_ID).one_or_none() - body = body.strip() - if body == '!slots': - body = f'!slots{snappy.coins}' - body_html = sanitize(body) if len(body_html) < 40000: