Update telegram.py

This commit is contained in:
Kamontat Chantrachirathumrong 2021-05-26 16:11:04 +07:00 committed by GitHub
parent e5c84b22bb
commit 4cca1cca85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,7 +238,12 @@ class Telegram(RPCHandler):
msg_type = str(msg['type']) msg_type = str(msg['type'])
noti = '' noti = ''
if msg_type == RPCMessageType.SELL: if msg_type == RPCMessageType.SELL:
noti = self._config['telegram'].get('notification_settings', {}).get(msg_type, {}).get(str(msg['sell_reason']), default_noti) sell_noti = self._config['telegram'].get('notification_settings', {}).get(msg_type, {})
# For backward compatibility sell still be string
if isinstance(noti, str):
noti = sell_noti
else:
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(msg_type, default_noti)