From 3444c6b0c45f6e53eb9adbce067023b26caa4041 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 21 Jul 2020 10:41:24 -0700 Subject: [PATCH] fixing bugs in send cmd --- tipbot/commands.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tipbot/commands.py b/tipbot/commands.py index 71f6241..7c160ac 100644 --- a/tipbot/commands.py +++ b/tipbot/commands.py @@ -168,20 +168,19 @@ def send(update, context): update.message.reply_text('Bad Wownero amount specified. Provide only positive integers or decimals greater than or equal to 1.') return False - tipper = db.User.get(telegram_id=update.message.from_user['id']) - tipper_balances = wownero.Wallet().balances(account=tipper.account_index) - if amount > tipper_balances[1]: + sender = db.User.get(telegram_id=update.message.from_user['id']) + sender_balances = wownero.Wallet().balances(account=sender.account_index) + if amount > sender_balances[1]: update.message.reply_text(f'You do not have sufficient funds to send {amount} WOW. Check your /balance') return False # transfer funds to given address try: - tx = wownero.Wallet().transfer(dest_address=address, amount=amount, priority=2, account=u.account_index) - print(tx) - update.message.reply_text(f'@{update.message.from_user["username"]} has tipped @{target_un} {amount} WOW!') + tx = wownero.Wallet().transfer(dest_address=address, amount=amount, priority=2, account=sender.account_index) + update.message.reply_text(f'Sent {amount} WOW! Tx: {tx}') except Exception as e: logging.error(f'Unable to send transfer: {e}. Debug: {update.message}') - update.message.reply_text('Failed to send a tip. Ask for help.') + update.message.reply_text('Failed to send Wownero. Ask for help.') @wallet_rpc_required @registration_required