add balance_dust_level parameter to make telegram less chatty
This commit is contained in:
parent
9968e4e49c
commit
0895407811
@ -243,7 +243,8 @@ CONF_SCHEMA = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'required': ['enabled', 'token', 'chat_id']
|
'required': ['enabled', 'token', 'chat_id'],
|
||||||
|
'balance_dust_level': 0.0001
|
||||||
},
|
},
|
||||||
'webhook': {
|
'webhook': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
@ -487,6 +487,8 @@ class Telegram(RPCHandler):
|
|||||||
result = self._rpc._rpc_balance(self._config['stake_currency'],
|
result = self._rpc._rpc_balance(self._config['stake_currency'],
|
||||||
self._config.get('fiat_display_currency', ''))
|
self._config.get('fiat_display_currency', ''))
|
||||||
|
|
||||||
|
balance_dust_level = self._config['telegram'].get('balance_dust_level', 0.0001 )
|
||||||
|
|
||||||
output = ''
|
output = ''
|
||||||
if self._config['dry_run']:
|
if self._config['dry_run']:
|
||||||
output += (
|
output += (
|
||||||
@ -496,7 +498,7 @@ class Telegram(RPCHandler):
|
|||||||
f"`{self._config['dry_run_wallet']}` {self._config['stake_currency']}.\n"
|
f"`{self._config['dry_run_wallet']}` {self._config['stake_currency']}.\n"
|
||||||
)
|
)
|
||||||
for curr in result['currencies']:
|
for curr in result['currencies']:
|
||||||
if curr['est_stake'] > 0.0001:
|
if curr['est_stake'] > balance_dust_level:
|
||||||
curr_output = (
|
curr_output = (
|
||||||
f"*{curr['currency']}:*\n"
|
f"*{curr['currency']}:*\n"
|
||||||
f"\t`Available: {curr['free']:.8f}`\n"
|
f"\t`Available: {curr['free']:.8f}`\n"
|
||||||
@ -505,7 +507,7 @@ class Telegram(RPCHandler):
|
|||||||
f"\t`Est. {curr['stake']}: "
|
f"\t`Est. {curr['stake']}: "
|
||||||
f"{round_coin_value(curr['est_stake'], curr['stake'], False)}`\n")
|
f"{round_coin_value(curr['est_stake'], curr['stake'], False)}`\n")
|
||||||
else:
|
else:
|
||||||
curr_output = f"*{curr['currency']}:* not showing <1$ amount \n"
|
curr_output = f"*{curr['currency']}:* not showing <{balance_dust_level} {curr['stake']} amount \n"
|
||||||
|
|
||||||
# Handle overflowing messsage length
|
# Handle overflowing messsage length
|
||||||
if len(output + curr_output) >= MAX_TELEGRAM_MESSAGE_LENGTH:
|
if len(output + curr_output) >= MAX_TELEGRAM_MESSAGE_LENGTH:
|
||||||
|
Loading…
Reference in New Issue
Block a user