Optional /whitelist args - sorted, nobase

Added two optional arguments for whitelist - `sorted` for alphabetical order and `nobase` for displaying the whitelist without base currency e.g. /USDT.

Updated help with optional commands.

Added a space in an unrelated help message.
This commit is contained in:
ecoppen 2022-08-10 14:56:38 +01:00
parent 573964b19f
commit c0d60c63ab
1 changed files with 9 additions and 2 deletions

View File

@ -1368,6 +1368,12 @@ class Telegram(RPCHandler):
try:
whitelist = self._rpc._rpc_whitelist()
if context.args:
if "sorted" in context.args:
whitelist['whitelist'] = sorted(whitelist['whitelist'])
if "nobase" in context.args:
whitelist['whitelist'] = [pair.split("/")[0] for pair in whitelist['whitelist']]
message = f"Using whitelist `{whitelist['method']}` with {whitelist['length']} pairs\n"
message += f"`{', '.join(whitelist['whitelist'])}`"
@ -1487,7 +1493,8 @@ class Telegram(RPCHandler):
"*/fx <trade_id>|all:* `Alias to /forceexit`\n"
f"{force_enter_text if self._config.get('force_entry_enable', False) else ''}"
"*/delete <trade_id>:* `Instantly delete the given trade in the database`\n"
"*/whitelist:* `Show current whitelist` \n"
"*/whitelist [sorted] [nobase]:* `Show current whitelist. Optionally in "
"order and/or without the base currency.`\n"
"*/blacklist [pair]:* `Show current blacklist, or adds one or more pairs "
"to the blacklist.` \n"
"*/blacklist_delete [pairs]| /bl_delete [pairs]:* "
@ -1524,7 +1531,7 @@ class Telegram(RPCHandler):
"*/weekly <n>:* `Shows statistics per week, over the last n weeks`\n"
"*/monthly <n>:* `Shows statistics per month, over the last n months`\n"
"*/stats:* `Shows Wins / losses by Sell reason as well as "
"Avg. holding durationsfor buys and sells.`\n"
"Avg. holding durations for buys and sells.`\n"
"*/help:* `This help message`\n"
"*/version:* `Show version`"
)