Add "empty" config to disable default discord messages

closes #9372
This commit is contained in:
Matthias
2023-11-02 18:09:41 +01:00
parent c920e3a031
commit 2a0175f629
2 changed files with 2 additions and 2 deletions

View File

@@ -302,6 +302,7 @@ You can configure this as follows:
``` ```
The above represents the default (`exit_fill` and `entry_fill` are optional and will default to the above configuration) - modifications are obviously possible. The above represents the default (`exit_fill` and `entry_fill` are optional and will default to the above configuration) - modifications are obviously possible.
To disable either of the two default values (`entry_fill` / `exit_fill`), you can assign them an empty array (`exit_fill: []`).
Available fields correspond to the fields for webhooks and are documented in the corresponding webhook sections. Available fields correspond to the fields for webhooks and are documented in the corresponding webhook sections.

View File

@@ -31,12 +31,11 @@ class Discord(Webhook):
def send_msg(self, msg) -> None: def send_msg(self, msg) -> None:
if msg['type'].value in self._config['discord']: if (fields := self._config['discord'].get(msg['type'].value)):
logger.info(f"Sending discord message: {msg}") logger.info(f"Sending discord message: {msg}")
msg['strategy'] = self.strategy msg['strategy'] = self.strategy
msg['timeframe'] = self.timeframe msg['timeframe'] = self.timeframe
fields = self._config['discord'].get(msg['type'].value)
color = 0x0000FF color = 0x0000FF
if msg['type'] in (RPCMessageType.EXIT, RPCMessageType.EXIT_FILL): if msg['type'] in (RPCMessageType.EXIT, RPCMessageType.EXIT_FILL):
profit_ratio = msg.get('profit_ratio') profit_ratio = msg.get('profit_ratio')