tg-bot/tipbot/commands/balance.py
2021-05-08 01:13:51 -07:00

16 lines
591 B
Python

import logging
from tipbot import wownero
from tipbot import db
from tipbot.helpers.decorators import wallet_rpc_required, log_event, registration_required, check_debug
@wallet_rpc_required
@registration_required
@log_event
@check_debug
def balance(update, context):
u = db.User.get(telegram_id=update.message.from_user['id'])
balances = wownero.Wallet().balances(account=u.account_index)
unlocked = balances[1]
locked = balances[0] - balances[1]
update.message.reply_text(f'Available balance for {u.telegram_user}: {float(unlocked)} WOW ({float(locked)} WOW locked)')