capitalize
parent
5b98c89cca
commit
93e8c43ddc
|
@ -166,7 +166,7 @@ def execute_snappy(post, v):
|
|||
g.db.add(award_object)
|
||||
|
||||
awarded_coins = int(AWARDS["glowie"]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
|
||||
post.author.pay_account('coins', awarded_coins, f"glowie award on {post.textlink}")
|
||||
post.author.pay_account('coins', awarded_coins, f"Glowie award on {post.textlink}")
|
||||
|
||||
msg = f"@Snappy has given {post.textlink} the Glowie Award and you have received {awarded_coins} coins as a result!"
|
||||
send_repeatable_notification(post.author.id, msg)
|
||||
|
|
|
@ -196,7 +196,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, obj=None, followers_ping=Tr
|
|||
if cost > v.coins + v.marseybux:
|
||||
abort(403, f"You need {cost} currency to mention these ping groups!")
|
||||
|
||||
reason = f"group pinging cost (<code>!everyone</code>)"
|
||||
reason = f"Group pinging cost (<code>!everyone</code>)"
|
||||
if obj:
|
||||
reason += f" on {obj.textlink}"
|
||||
v.charge_account('coins/marseybux', cost, reason)
|
||||
|
@ -244,7 +244,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, obj=None, followers_ping=Tr
|
|||
|
||||
if charge:
|
||||
if cost:
|
||||
reason = f"group pinging cost (<code>!" + "</code>, <code>!".join(cost_groups) + "</code>)"
|
||||
reason = f"Group pinging cost (<code>!" + "</code>, <code>!".join(cost_groups) + "</code>)"
|
||||
if obj:
|
||||
reason += f" on {obj.textlink}"
|
||||
v.charge_account('coins/marseybux', cost, reason)
|
||||
|
|
|
@ -353,7 +353,7 @@ def _unpin_expired():
|
|||
def _give_marseybux_salary():
|
||||
for u in g.db.query(User).filter(User.admin_level > 0).all():
|
||||
marseybux_salary = u.admin_level * 10000
|
||||
u.pay_account('marseybux', marseybux_salary, "janny salary")
|
||||
u.pay_account('marseybux', marseybux_salary, "Janny salary")
|
||||
send_repeatable_notification(u.id, f"You have received your monthly janny salary of {marseybux_salary} Marseybux!")
|
||||
|
||||
def _expire_blocks_mutes_exiles():
|
||||
|
|
|
@ -47,7 +47,7 @@ def end_lottery_session():
|
|||
winner = random.choice(raffle)
|
||||
active_lottery.winner_id = winner
|
||||
winning_user = next(filter(lambda x: x.id == winner, participating_users))
|
||||
winning_user.pay_account('coins', active_lottery.prize, "lottery winnings")
|
||||
winning_user.pay_account('coins', active_lottery.prize, "Lottery winnings")
|
||||
winning_user.total_lottery_winnings += active_lottery.prize
|
||||
badge_grant(user=winning_user, badge_id=LOTTERY_WINNER_BADGE_ID)
|
||||
|
||||
|
@ -109,7 +109,7 @@ def purchase_lottery_tickets(v, quantity=1):
|
|||
if (most_recent_lottery is None):
|
||||
return False, "There is no active lottery!"
|
||||
|
||||
if not v.charge_account('coins', LOTTERY_TICKET_COST * quantity, f'cost of {quantity} lottery tickets')[0]:
|
||||
if not v.charge_account('coins', LOTTERY_TICKET_COST * quantity, f'Cost of {quantity} lottery tickets')[0]:
|
||||
return False, "You don't have enough coins"
|
||||
|
||||
v.currently_held_lottery_tickets += quantity
|
||||
|
|
|
@ -85,7 +85,7 @@ def get_active_roulette_games():
|
|||
|
||||
|
||||
def charge_gambler(gambler, amount, currency):
|
||||
charged = gambler.charge_account(currency, amount, "cost of roulette bet")[0]
|
||||
charged = gambler.charge_account(currency, amount, "Cost of roulette bet")[0]
|
||||
|
||||
if not charged:
|
||||
raise Exception("Gambler cannot afford charge.")
|
||||
|
@ -179,8 +179,8 @@ def spin_roulette_wheel():
|
|||
coin_winnings = gambler_payout['coins']
|
||||
procoin_winnings = gambler_payout['marseybux']
|
||||
|
||||
gambler.pay_account('coins', coin_winnings, "roulette winnings")
|
||||
gambler.pay_account('marseybux', procoin_winnings, "roulette winnings")
|
||||
gambler.pay_account('coins', coin_winnings, "Roulette winnings")
|
||||
gambler.pay_account('marseybux', procoin_winnings, "Roulette winnings")
|
||||
|
||||
# Notify the winners.
|
||||
notification_text = f"Winning number: {number}\n\nCongratulations! One or more of your roulette bets paid off!\n\n"
|
||||
|
|
|
@ -57,7 +57,7 @@ def casino_slot_pull(gambler, wager_value, currency):
|
|||
user_id=gambler.id,
|
||||
currency=currency,
|
||||
amount=-casino_game.winnings,
|
||||
reason="slots bet",
|
||||
reason="Slots bet",
|
||||
)
|
||||
g.db.add(currency_log)
|
||||
if currency == 'coins':
|
||||
|
|
|
@ -40,5 +40,5 @@ def check_for_treasure(from_comment, in_text):
|
|||
from_comment.treasure_amount = f'l{ticket_count}'
|
||||
return
|
||||
|
||||
user.pay_account('coins', amount, f"found treasure in {from_comment.textlink}")
|
||||
user.pay_account('coins', amount, f"Found treasure in {from_comment.textlink}")
|
||||
from_comment.treasure_amount = str(amount)
|
||||
|
|
|
@ -325,7 +325,7 @@ def handle_payout(gambler, state, game):
|
|||
user_id=gambler.id,
|
||||
currency=game.currency,
|
||||
amount=-game.winnings,
|
||||
reason="blackjack bet",
|
||||
reason="Blackjack bet",
|
||||
)
|
||||
g.db.add(currency_log)
|
||||
if currency == 'coins':
|
||||
|
|
|
@ -188,7 +188,7 @@ def distribute(v, kind, option_id):
|
|||
cid = notif_comment(text)
|
||||
for vote in votes:
|
||||
u = vote.user
|
||||
u.pay_account('coins', coinsperperson, f"bet winnings on {parent.textlink}")
|
||||
u.pay_account('coins', coinsperperson, f"Bet winnings on {parent.textlink}")
|
||||
add_notif(cid, u.id, text, pushnotif_url=parent.permalink)
|
||||
|
||||
text = f"You lost the {POLL_BET_COINS} coins you bet on {parent.textlink} :marseylaugh:"
|
||||
|
@ -2163,7 +2163,7 @@ def mark_effortpost(pid, v):
|
|||
|
||||
coins = (p.upvotes + p.downvotes) * mul
|
||||
|
||||
p.author.pay_account('coins', coins, f"retroactive efortpost gains of {post.textlink}")
|
||||
p.author.pay_account('coins', coins, f"Retroactive efortpost gains of {post.textlink}")
|
||||
|
||||
if v.id != p.author_id:
|
||||
send_repeatable_notification(p.author_id, f":marseyclapping: @{v.username} (a site admin) has marked {p.textlink} as an effortpost, it now gets x{mul} coins from votes. You have received {coins} coins retroactively, thanks! :!marseyclapping:")
|
||||
|
@ -2200,7 +2200,7 @@ def unmark_effortpost(pid, v):
|
|||
|
||||
coins = (p.upvotes + p.downvotes) * mul
|
||||
|
||||
p.author.charge_account('coins', coins, f"revocation of efortpost gains of {post.textlink}")
|
||||
p.author.charge_account('coins', coins, f"Revocation of efortpost gains of {post.textlink}")
|
||||
|
||||
if v.id != p.author_id:
|
||||
send_repeatable_notification(p.author_id, f":marseyitsover: @{v.username} (a site admin) has unmarked {p.textlink} as an effortpost. {coins} coins have been deducted from you. :!marseyitsover:")
|
||||
|
|
|
@ -225,7 +225,7 @@ def approve_emoji(v, name):
|
|||
if 'pkmn' in emoji.tags: amount = 500
|
||||
else: amount = 250
|
||||
|
||||
author.pay_account('coins', amount, f"reward for making :{emoji.name}:")
|
||||
author.pay_account('coins', amount, f"Reward for making <code>:{emoji.name}:</code>")
|
||||
g.db.add(author)
|
||||
|
||||
if v.id != author.id:
|
||||
|
|
|
@ -64,7 +64,7 @@ def buy_award(v, kind, AWARDS):
|
|||
else:
|
||||
currency = 'coins/marseybux'
|
||||
|
||||
charged = v.charge_account(currency, price, f"{kind} award cost")
|
||||
charged = v.charge_account(currency, price, f"{AWARDS[kind]['title']} award cost")
|
||||
if not charged[0]:
|
||||
abort(400, f"Not enough {currency}!")
|
||||
|
||||
|
@ -238,8 +238,8 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
if kind == 'shit':
|
||||
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
|
||||
v.charge_account('coins', awarded_coins, f"shit award deflected theft on {obj.textlink}", should_check_balance=False)
|
||||
obj.author.pay_account('coins', awarded_coins, f"shit award deflected theft on {obj.textlink}")
|
||||
v.charge_account('coins', awarded_coins, f"Deflected shit award on {obj.textlink}", should_check_balance=False)
|
||||
obj.author.pay_account('coins', awarded_coins, f"Deflected shit award on {obj.textlink}")
|
||||
elif kind != 'spider':
|
||||
if AWARDS[kind]['cosmetic'] and not AWARDS[kind]['included_in_lootbox']:
|
||||
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
|
||||
|
@ -248,10 +248,10 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
if awarded_coins:
|
||||
if kind == 'shit':
|
||||
author.charge_account('coins', awarded_coins, f"shit award theft on {obj.textlink}", should_check_balance=False)
|
||||
v.pay_account('coins', awarded_coins, f"shit award theft on {obj.textlink}")
|
||||
author.charge_account('coins', awarded_coins, f"Shit award on {obj.textlink}", should_check_balance=False)
|
||||
v.pay_account('coins', awarded_coins, f"Shit award on {obj.textlink}")
|
||||
else:
|
||||
author.pay_account('coins', awarded_coins)
|
||||
author.pay_account('coins', awarded_coins, f"{award_title} award on {obj.textlink}")
|
||||
|
||||
if kind == 'marsify' and author.marsify == 1:
|
||||
abort(409, f"{safe_username} already permanently marsified!")
|
||||
|
@ -479,7 +479,7 @@ def award_thing(v, thing_type, id):
|
|||
author.patron = 1
|
||||
if author.patron_utc: author.patron_utc += 2629746
|
||||
else: author.patron_utc = int(time.time()) + 2629746
|
||||
author.pay_account('marseybux', 1250, f"benefactor award on {obj.textlink}")
|
||||
author.pay_account('marseybux', 1250, f"Benefactor award on {obj.textlink}")
|
||||
badge_grant(user=v, badge_id=103)
|
||||
elif kind == "rehab":
|
||||
if author.rehab: author.rehab += 86400
|
||||
|
|
|
@ -35,7 +35,7 @@ def create_group(v):
|
|||
if name in {'everyone', 'jannies', 'holejannies', 'followers', 'commenters'} or g.db.get(Group, name):
|
||||
abort(400, "This group already exists!")
|
||||
|
||||
if not v.charge_account('coins/marseybux', GROUP_COST, f"cost of creating !{name}")[0]:
|
||||
if not v.charge_account('coins/marseybux', GROUP_COST, f"Cost of creating !{name}")[0]:
|
||||
abort(403, "You don't have enough coins or marseybux!")
|
||||
|
||||
g.db.add(v)
|
||||
|
|
|
@ -44,12 +44,12 @@ def buy_hat(v, hat_id):
|
|||
if not hat.is_purchasable:
|
||||
abort(403, "This hat is not for sale!")
|
||||
|
||||
charged = v.charge_account('coins/marseybux', hat.price, f"{hat.name} hat cost")
|
||||
charged = v.charge_account('coins/marseybux', hat.price, f"<code>{hat.name}</code> hat cost")
|
||||
if not charged[0]:
|
||||
abort(400, "Not enough coins/marseybux!")
|
||||
|
||||
v.coins_spent_on_hats += charged[1]
|
||||
hat.author.pay_account('coins', hat.price * 0.1, f"royalties for `{hat.name}`")
|
||||
hat.author.pay_account('coins', hat.price * 0.1, f"Royalties for <code>{hat.name}</code> hat")
|
||||
|
||||
new_hat = Hat(user_id=v.id, hat_id=hat.id)
|
||||
g.db.add(new_hat)
|
||||
|
|
|
@ -393,7 +393,7 @@ def create_sub2(v):
|
|||
if not hole_group_name_regex.fullmatch(name):
|
||||
abort(400, "Name does not match the required format!")
|
||||
|
||||
if not v.charge_account('coins/marseybux', HOLE_COST, f"cost of creating /h/{name}")[0]:
|
||||
if not v.charge_account('coins/marseybux', HOLE_COST, f"Cost of creating /h/{name}")[0]:
|
||||
abort(400, "You don't have enough coins or marseybux!")
|
||||
|
||||
hole = get_hole(name, graceful=True)
|
||||
|
|
|
@ -26,7 +26,7 @@ def vote_option(option_id, v):
|
|||
if option.exclusive == 2:
|
||||
if option.parent.total_bet_voted(v):
|
||||
abort(403, "You can't participate in a closed bet!")
|
||||
if not v.charge_account('coins/marseybux', POLL_BET_COINS, f"cost of bet on {option.parent.textlink}")[0]:
|
||||
if not v.charge_account('coins/marseybux', POLL_BET_COINS, f"Cost of bet on {option.parent.textlink}")[0]:
|
||||
abort(400, f"You don't have {POLL_BET_COINS} coins or marseybux!")
|
||||
g.db.add(v)
|
||||
|
||||
|
@ -79,7 +79,7 @@ def vote_option_comment(option_id, v):
|
|||
if option.exclusive == 2:
|
||||
if option.parent.total_bet_voted(v):
|
||||
abort(403, "You can't participate in a closed bet!")
|
||||
if not v.charge_account('coins/marseybux', POLL_BET_COINS, f"cost of bet on {option.parent.textlink}")[0]:
|
||||
if not v.charge_account('coins/marseybux', POLL_BET_COINS, f"Cost of bet on {option.parent.textlink}")[0]:
|
||||
abort(400, f"You don't have {POLL_BET_COINS} coins or marseybux!")
|
||||
g.db.add(v)
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ def settings_personal_post(v):
|
|||
else:
|
||||
cost = HOUSE_JOIN_COST
|
||||
|
||||
success = v.charge_account('coins/marseybux', cost, "cost of changing houses")[0]
|
||||
success = v.charge_account('coins/marseybux', cost, "Cost of changing houses")[0]
|
||||
if not success: abort(403)
|
||||
|
||||
if house == "None":
|
||||
|
|
|
@ -78,7 +78,7 @@ def claim_rewards_all_users():
|
|||
marseybux = int(marseybux)
|
||||
text = f"You have received {marseybux} Marseybux! You can use them to buy awards or hats in the [shop](/shop/awards) or gamble them in the [casino](/casino)."
|
||||
|
||||
user.pay_account('marseybux', marseybux, f"{patron.lower()} reward")
|
||||
user.pay_account('marseybux', marseybux, f"{patron} reward")
|
||||
|
||||
send_repeatable_notification(user.id, text)
|
||||
g.db.add(user)
|
||||
|
@ -147,13 +147,13 @@ def transfer_currency(v, username, currency_name, apply_tax):
|
|||
notif_text += f"\n\n> {reason}"
|
||||
log_message += f"\n\n> {reason}"
|
||||
|
||||
if not v.charge_account(currency_name, amount, f"gift to @{username}")[0]:
|
||||
if not v.charge_account(currency_name, amount, f"Gift to @{username}")[0]:
|
||||
abort(400, f"You don't have enough {currency_name}")
|
||||
|
||||
if currency_name == 'marseybux':
|
||||
receiver.pay_account('marseybux', amount - tax, f"gift from @{v.username}")
|
||||
receiver.pay_account('marseybux', amount - tax, f"Gift from @{v.username}")
|
||||
elif currency_name == 'coins':
|
||||
receiver.pay_account('coins', amount - tax, f"gift from @{v.username}")
|
||||
receiver.pay_account('coins', amount - tax, f"Gift from @{v.username}")
|
||||
else:
|
||||
raise ValueError(f"Invalid currency '{currency_name}' got when transferring {amount} from {v.id} to {receiver.id}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue