Make telegram message beautiful
This commit is contained in:
parent
f175f48418
commit
d112d90e8e
@ -264,17 +264,15 @@ class Telegram(RPC):
|
||||
(currencys, total, symbol, value) = result
|
||||
output = ''
|
||||
for currency in currencys:
|
||||
output += """*Currency*: {currency}
|
||||
*Available*: {available}
|
||||
*Balance*: {balance}
|
||||
*Pending*: {pending}
|
||||
*Est. BTC*: {est_btc: .8f}
|
||||
""".format(**currency)
|
||||
output += "*{currency}:*\n" \
|
||||
"\t`Available: {available: .8f}`\n" \
|
||||
"\t`Balance: {balance: .8f}`\n" \
|
||||
"\t`Pending: {pending: .8f}`\n" \
|
||||
"\t`Est. BTC: {est_btc: .8f}`\n".format(**currency)
|
||||
|
||||
output += """*Estimated Value*:
|
||||
*BTC*: {0: .8f}
|
||||
*{1}*: {2: .2f}
|
||||
""".format(total, symbol, value)
|
||||
output += "\n*Estimated Value*:\n" \
|
||||
"\t`BTC: {0: .8f}`\n" \
|
||||
"\t`{1}: {2: .2f}`\n".format(total, symbol, value)
|
||||
self.send_msg(output)
|
||||
|
||||
@authorized_only
|
||||
|
@ -614,12 +614,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
|
||||
telegram._balance(bot=MagicMock(), update=update)
|
||||
result = msg_mock.call_args_list[0][0][0]
|
||||
assert msg_mock.call_count == 1
|
||||
assert '*Currency*: BTC' in result
|
||||
assert '*Currency*: ETH' not in result
|
||||
assert '*Currency*: USDT' in result
|
||||
assert 'Balance' in result
|
||||
assert 'Est. BTC' in result
|
||||
assert '*BTC*: 14.00000000' in result
|
||||
assert '*BTC:*' in result
|
||||
assert '*ETH:*' not in result
|
||||
assert '*USDT:*' in result
|
||||
assert 'Balance:' in result
|
||||
assert 'Est. BTC:' in result
|
||||
assert 'BTC: 14.00000000' in result
|
||||
|
||||
|
||||
def test_zero_balance_handle(default_conf, update, mocker) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user