Deserialized variant for bundle backtest
This commit is contained in:
@@ -12,23 +12,23 @@ public class WebhookService : IWebhookService
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<WebhookService> _logger;
|
||||
private readonly string _n8nWebhookUrl;
|
||||
|
||||
public WebhookService(HttpClient httpClient, IConfiguration configuration, ILogger<WebhookService> logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
_n8nWebhookUrl = _configuration["N8n:WebhookUrl"] ?? string.Empty;
|
||||
}
|
||||
|
||||
public async Task SendTradeNotification(User user, string message, bool isBadBehavior = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get the n8n webhook URL from configuration
|
||||
var webhookUrl = _configuration["N8n:WebhookUrl"];
|
||||
if (string.IsNullOrEmpty(webhookUrl))
|
||||
if (string.IsNullOrEmpty(user.TelegramChannel))
|
||||
{
|
||||
_logger.LogWarning("N8n webhook URL not configured, skipping webhook notification");
|
||||
_logger.LogWarning("No telegram channel configured");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WebhookService : IWebhookService
|
||||
};
|
||||
|
||||
// Send the webhook notification
|
||||
var response = await _httpClient.PostAsJsonAsync(webhookUrl, payload);
|
||||
var response = await _httpClient.PostAsJsonAsync(_n8nWebhookUrl, payload);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -64,11 +64,9 @@ public class WebhookService : IWebhookService
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get the n8n webhook URL from configuration
|
||||
var webhookUrl = _configuration["N8n:WebhookUrl"];
|
||||
if (string.IsNullOrEmpty(webhookUrl))
|
||||
if (string.IsNullOrEmpty(telegramChannel))
|
||||
{
|
||||
_logger.LogWarning("N8n webhook URL not configured, skipping webhook message");
|
||||
_logger.LogWarning("No telegram channel configured");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +80,7 @@ public class WebhookService : IWebhookService
|
||||
};
|
||||
|
||||
// Send the webhook notification
|
||||
var response = await _httpClient.PostAsJsonAsync(webhookUrl, payload);
|
||||
var response = await _httpClient.PostAsJsonAsync(_n8nWebhookUrl, payload);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user