def deposit(account_from_user): amount_to_deposit = int(input("How much would you like to deposit: \n >")) balance = sql.get_balance(account_from_user) new_balance = amount_to_deposit + balance sql.update_balance(account_from_user, new_balance) print(f"Your new balance is: {new_balance}") print("Deposited...")
def balance(update, _): (money, high, chip) = sql.get_balance(telegram_id=update.message.from_user.id) update.message.reply_markdown(text=text.BALANCE.format( money=text.three_digits(n=money), high=text.three_digits(n=high), chip=text.three_digits(n=chip)), reply_markup=menu.show(menu=text.HOME)) return state.HOME
def withdraw(self, amount): original_balance = sql.get_balance(self.logged_user)[0]['balance'] bal = int(original_balance) - amount sql.alter_balance(self.logged_user, bal) print("Deposit Successfull...!")
def withdraw(account_from_user): amount_to_withdraw = int(input("How much would you like to withdraw: \n >")) balance = sql.get_balance(account_from_user) if balance >= amount_to_withdraw: new_balance = balance - amount_to_withdraw print(f"Your new balance is: {new_balance}") sql.update_balance(account_from_user, new_balance) else: print("Insufficient Balance")
def deposit(self, amount, name="self"): target_name = name if name != "self" else self.logged_user print(target_name) original_balance = sql.get_balance(target_name)[0]['balance'] bal = int(original_balance) + amount sql.alter_balance(target_name, bal) print("Deposit Successfull...!")
def street_enter_high(update, _): (money, high, _) = sql.get_balance(telegram_id=update.message.from_user.id) update.message.reply_markdown( text=text.STREET_ENTER_HIGH_TEXT.format(money=text.three_digits(n=money), high=text.three_digits(n=high)), reply_markup=menu.show(menu=text.BACK)) return state.STREET_ENTER_HIGH
def dealer(update, _): (_, high, _) = sql.get_balance(telegram_id=update.message.from_user.id) update.message.reply_markdown(text=text.DEALER_DESC.format(high=text.three_digits(n=high)), reply_markup=menu.show(menu=text.BACK)) return state.DEALER