Improve formatting of telegram message
This commit is contained in:
parent
817f5289db
commit
075c73b9e3
@ -6,7 +6,7 @@ from abc import abstractmethod
|
||||
from datetime import date, datetime, timedelta
|
||||
from enum import Enum
|
||||
from math import isnan
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
import arrow
|
||||
from numpy import NAN, mean
|
||||
@ -538,7 +538,7 @@ class RPC:
|
||||
else:
|
||||
return None
|
||||
|
||||
def _rpc_delete(self, trade_id: str) -> Dict[str, str]:
|
||||
def _rpc_delete(self, trade_id: str) -> Dict[str, Union[str, int]]:
|
||||
"""
|
||||
Handler for delete <id>.
|
||||
Delete the given trade and close eventually existing open orders.
|
||||
|
@ -547,7 +547,10 @@ class Telegram(RPC):
|
||||
trade_id = context.args[0] if len(context.args) > 0 else None
|
||||
try:
|
||||
msg = self._rpc_delete(trade_id)
|
||||
self._send_msg('Delete Result: `{result_msg}`'.format(**msg))
|
||||
self._send_msg((
|
||||
'Delete Result: `{result_msg}`'
|
||||
'Please make sure to take care of this asset on the exchange manually.'
|
||||
).format(**msg))
|
||||
|
||||
except RPCException as e:
|
||||
self._send_msg(str(e))
|
||||
|
@ -1200,8 +1200,8 @@ def test_telegram_delete_trade(mocker, update, default_conf, fee):
|
||||
context.args = [1]
|
||||
telegram._delete_trade(update=update, context=context)
|
||||
msg_mock.call_count == 1
|
||||
assert "Delete Result" in msg_mock.call_args_list[0][0][0]
|
||||
assert "Deleted trade 1." in msg_mock.call_args_list[0][0][0]
|
||||
assert "Please make sure to take care of this asset" in msg_mock.call_args_list[0][0][0]
|
||||
|
||||
|
||||
def test_help_handle(default_conf, update, mocker) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user