Properly deprecate webhook settings (with transition)

This commit is contained in:
Matthias
2022-04-04 19:19:54 +02:00
parent 5ecb695e50
commit 125dff1dad
3 changed files with 12 additions and 8 deletions

View File

@@ -90,6 +90,12 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
'notification_settings', 'exit_fill')
process_deprecated_setting(config['telegram'], 'notification_settings', 'sell_cancel',
'notification_settings', 'exit_cancel')
if config.get('webhook'):
process_deprecated_setting(config, 'webhook', 'webhooksell', 'webhook', 'webhookexit')
process_deprecated_setting(config, 'webhook', 'webhooksellcancel',
'webhook', 'webhookexitcancel')
process_deprecated_setting(config, 'webhook', 'webhooksellfill',
'webhook', 'webhookexitfill')
# Legacy way - having them in experimental ...
process_removed_setting(config, 'experimental', 'use_sell_signal',

View File

@@ -44,7 +44,6 @@ class Webhook(RPCHandler):
""" Send a message to telegram channel """
try:
whconfig = self._config['webhook']
# DEPRECATED: Sell terminology
if msg['type'] in [RPCMessageType.BUY, RPCMessageType.SHORT]:
valuedict = whconfig.get('webhookbuy', None)
elif msg['type'] in [RPCMessageType.BUY_CANCEL, RPCMessageType.SHORT_CANCEL]:
@@ -52,12 +51,11 @@ class Webhook(RPCHandler):
elif msg['type'] in [RPCMessageType.BUY_FILL, RPCMessageType.SHORT_FILL]:
valuedict = whconfig.get('webhookbuyfill', None)
elif msg['type'] == RPCMessageType.EXIT:
valuedict = whconfig.get('webhookexit', whconfig.get('webhooksell', None))
valuedict = whconfig.get('webhookexit', None)
elif msg['type'] == RPCMessageType.EXIT_FILL:
valuedict = whconfig.get('webhookexitfill', whconfig.get('webhookexitfill', None))
valuedict = whconfig.get('webhookexitfill', None)
elif msg['type'] == RPCMessageType.EXIT_CANCEL:
valuedict = whconfig.get('webhookexitcancel',
whconfig.get('webhooksellcancel', None))
valuedict = whconfig.get('webhookexitcancel', None)
elif msg['type'] in (RPCMessageType.STATUS,
RPCMessageType.STARTUP,
RPCMessageType.WARNING):