Update telegram.py
This commit is contained in:
parent
e2be9bb4e0
commit
4fc84d4910
@ -235,17 +235,17 @@ class Telegram(RPCHandler):
|
|||||||
|
|
||||||
default_noti = 'on'
|
default_noti = 'on'
|
||||||
|
|
||||||
msg_type = str(msg['type'])
|
msg_type = msg['type']
|
||||||
noti = ''
|
noti = ''
|
||||||
if msg_type == RPCMessageType.SELL:
|
if msg_type == RPCMessageType.SELL:
|
||||||
sell_noti = self._config['telegram'].get('notification_settings', {}).get(msg_type, {})
|
sell_noti = self._config['telegram'].get('notification_settings', {}).get(str(msg_type), {})
|
||||||
# For backward compatibility sell still be string
|
# For backward compatibility sell still be string
|
||||||
if isinstance(noti, str):
|
if isinstance(noti, str):
|
||||||
noti = sell_noti
|
noti = sell_noti
|
||||||
else:
|
else:
|
||||||
noti = sell_noti.get(str(msg['sell_reason']), default_noti)
|
noti = sell_noti.get(str(msg['sell_reason']), default_noti)
|
||||||
else:
|
else:
|
||||||
noti = self._config['telegram'].get('notification_settings', {}).get(msg_type, default_noti)
|
noti = self._config['telegram'].get('notification_settings', {}).get(str(msg_type), default_noti)
|
||||||
|
|
||||||
if noti == 'off':
|
if noti == 'off':
|
||||||
logger.info(f"Notification '{msg_type}' not sent.")
|
logger.info(f"Notification '{msg_type}' not sent.")
|
||||||
@ -364,7 +364,7 @@ class Telegram(RPCHandler):
|
|||||||
self._send_msg(str(e))
|
self._send_msg(str(e))
|
||||||
|
|
||||||
@authorized_only
|
@authorized_only
|
||||||
def _status_table(self, update: Update, context: CallbackContext) -> None:
|
def _status_table(self, *_) -> None:
|
||||||
"""
|
"""
|
||||||
Handler for /status table.
|
Handler for /status table.
|
||||||
Returns the current TradeThread status in table format
|
Returns the current TradeThread status in table format
|
||||||
|
Loading…
Reference in New Issue
Block a user