Update bot messages
This commit is contained in:
@@ -68,6 +68,11 @@ public class MessengerService : IMessengerService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendMessage(string message, string telegramChannel)
|
||||
{
|
||||
await _webhookService.SendMessage(message, telegramChannel);
|
||||
}
|
||||
|
||||
private string BuildPositionMessage(Position position)
|
||||
{
|
||||
var direction = position.OriginDirection.ToString();
|
||||
|
||||
@@ -77,7 +77,7 @@ public class WebhookService : IWebhookService
|
||||
message = message,
|
||||
timestamp = DateTime.UtcNow,
|
||||
type = "general_message",
|
||||
telegramChannel = telegramChannel
|
||||
telegramChannel = FormatTelegramChannel(telegramChannel)
|
||||
};
|
||||
|
||||
// Send the webhook notification
|
||||
@@ -97,4 +97,23 @@ public class WebhookService : IWebhookService
|
||||
_logger.LogError(ex, "Error sending webhook message");
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatTelegramChannel(string? telegramChannel)
|
||||
{
|
||||
if (string.IsNullOrEmpty(telegramChannel))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (telegramChannel.StartsWith("100"))
|
||||
{
|
||||
return telegramChannel.Substring(3);
|
||||
}
|
||||
else if (telegramChannel.StartsWith("-100"))
|
||||
{
|
||||
return telegramChannel.Substring(4);
|
||||
}
|
||||
|
||||
return telegramChannel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user