From fbddf3e59ca565ea2417f10124debe6f42a2b36f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 7 Nov 2022 02:08:50 +0200 Subject: [PATCH] fix snappy gambling --- files/helpers/actions.py | 6 +++--- files/helpers/slots.py | 6 +++--- files/routes/comments.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index b43c314f3..09d3534c1 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -3,7 +3,7 @@ from files.helpers.alerts import send_repeatable_notification from files.helpers.const import * from files.helpers.get import * from files.helpers.sanitize import * -from files.helpers.slots import execute_slots_command +from files.helpers.slots import check_slots_command import random from urllib.parse import quote @@ -145,12 +145,12 @@ def execute_snappy(post, v): g.db.add(c) + check_slots_command(v, snappy, c) + snappy.comment_count += 1 snappy.coins += 1 g.db.add(snappy) - execute_slots_command(snappy, v, c) - if FEATURES['PINS'] and (body.startswith(':#marseypin:') or body.startswith(':#marseypin2:')): post.stickied = "Snappy" post.stickied_utc = int(time.time()) + 3600 diff --git a/files/helpers/slots.py b/files/helpers/slots.py index c1d575834..02c58ff5f 100644 --- a/files/helpers/slots.py +++ b/files/helpers/slots.py @@ -51,7 +51,7 @@ def casino_slot_pull(gambler, wager_value, currency): return casino_game.id, casino_game.game_state else: - return 0, "{}", + return None, "{}", def build_symbols(for_payout): @@ -117,7 +117,7 @@ def shuffle(stuff): return stuff -def execute_slots_command(v:User, u:User, c:Comment): +def check_slots_command(v:User, u:User, c:Comment): if not FEATURES['GAMBLING']: return body = c.body.lower() @@ -153,5 +153,5 @@ def execute_slots_command(v:User, u:User, c:Comment): abort(400, f"Not enough {currency} to make that bet") return - game_id, game_state = casino_slot_pull(v, wager, currency) + game_id, game_state = casino_slot_pull(u, wager, currency) c.casino_game_id = game_id diff --git a/files/routes/comments.py b/files/routes/comments.py index 6eb582c68..23c293cef 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -357,7 +357,7 @@ def comment(v): parent_post.comment_count += 1 g.db.add(parent_post) - execute_slots_command(v, v, c) + check_slots_command(v, v, c) g.db.flush()