make snappy gamble again

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-11-02 00:40:22 +02:00
parent 141ec98c06
commit da5cc4093f
4 changed files with 41 additions and 29 deletions

View File

@ -93,6 +93,8 @@ def execute_snappy(post, v):
)
g.db.add(vote)
post.upvotes += 1
elif body == '!slots':
body = f'!slots{snappy.coins}'
body += "\n\n"
@ -169,6 +171,9 @@ def execute_snappy(post, v):
snappy.coins += 1
g.db.add(snappy)
if c.body.startswith('!slots'):
execute_slots_command(snappy, c)
if FEATURES['PINS'] and (body.startswith(':#marseypin:') or body.startswith(':#marseypin2:')):
post.stickied = "Snappy"
post.stickied_utc = int(time.time()) + 3600

View File

@ -113,3 +113,34 @@ def determine_payout():
def shuffle(stuff):
random.shuffle(stuff)
return stuff
def execute_slots_command(u, c):
body = c.body.lower()
if u.rehab:
abort(403, "You are under Rehab award effect!")
if '!slotsmb' in body:
command_word = '!slotsmb'
currency = 'procoins'
else:
command_word = '!slots'
currency = 'coins'
wager = body.split(command_word)[1].split()[0]
try:
wager = int(wager)
except:
abort(400, "Invalid wager.")
if wager < 100:
abort(400, f"Wager must be 100 {currency} or more")
if (currency == "coins" and wager > u.coins) or (currency == "procoins" and wager > u.procoins):
abort(400, f"Not enough {currency} to make that bet")
game_id, game_state = casino_slot_pull(v, wager, currency)
c.casino_game_id = game_id

View File

@ -357,34 +357,8 @@ def comment(v):
parent_post.comment_count += 1
g.db.add(parent_post)
body = c.body.lower()
if FEATURES['GAMBLING'] and '!slots' in body:
if v.rehab:
abort(403, "You are under Rehab award effect!")
if '!slotsmb' in body:
command_word = '!slotsmb'
currency = 'procoins'
else:
command_word = '!slots'
currency = 'coins'
wager = body.split(command_word)[1].split()[0]
try:
wager = int(wager)
except:
abort(400, "Invalid wager.")
if wager < 100:
abort(400, f"Wager must be 100 {currency} or more")
if (currency == "coins" and wager > v.coins) or (currency == "procoins" and wager > v.procoins):
abort(400, f"Not enough {currency} to make that bet")
game_id, game_state = casino_slot_pull(v, wager, currency)
c.casino_game_id = game_id
if FEATURES['GAMBLING'] and '!slots' in c.body.lower():
execute_slots_command(v, c)
g.db.flush()

View File

@ -3144,4 +3144,6 @@ On top of that, you're going to have be very careful with what you do and how, b
This is going to be interesting to put it mildly no matter how it goes. I mean you did fuck with a major court case that has eyes on it all over the country, and they've already getting cops involved and looks like the FBI is joining too.
I'm just saying it won't be pleasant.
I'm just saying it won't be pleasant.
{[para]}
!slots