forked from kodorvan/stcs
The message about the Bybit profile output has been corrected when clicking the "Start" button, and messages regarding the requirement to connect the platform and incorrect API entries have been added. Messages about successful and erroneous changes to user settings have been added.
This commit is contained in:
@@ -13,10 +13,21 @@ async def get_balance(tg_id, message):
|
||||
api_secret=secret_key
|
||||
)
|
||||
|
||||
try:
|
||||
balance = client.get_wallet_balance(accountType='UNIFIED', coin='USDT')['result']['list'][0]['coin'][0]['walletBalance']
|
||||
if api_key == 'None' or secret_key == 'None':
|
||||
await message.answer('⚠️ Подключите платформу для торговли')
|
||||
return 0
|
||||
|
||||
return balance
|
||||
try:
|
||||
check_user = client.get_wallet_balance()
|
||||
|
||||
if check_user:
|
||||
try:
|
||||
balance = client.get_wallet_balance(accountType='UNIFIED', coin='USDT')['result']['list'][0]['coin'][0]['walletBalance']
|
||||
|
||||
return balance
|
||||
except Exception as e:
|
||||
await message.answer('⚠️ Ошибка при получении баланса пользователя')
|
||||
return 0
|
||||
except Exception as e:
|
||||
await message.answer('Баланс не был получен, подключите платформу')
|
||||
await message.answer('⚠️ Неверные данные API, перепроверьте их')
|
||||
return 0
|
Reference in New Issue
Block a user