Update tg message

This commit is contained in:
2025-07-06 15:59:39 +07:00
parent 46b43bce1a
commit a17b780731

View File

@@ -144,13 +144,15 @@ namespace Managing.Application.ManageBot
}
else
{
throw new ArgumentException($"Scenario '{scalpingConfig.ScenarioName}' not found in database when loading backup");
throw new ArgumentException(
$"Scenario '{scalpingConfig.ScenarioName}' not found in database when loading backup");
}
}
if (scalpingConfig.Scenario == null)
{
throw new ArgumentException("Scenario object must be provided or ScenarioName must be valid when loading backup");
throw new ArgumentException(
"Scenario object must be provided or ScenarioName must be valid when loading backup");
}
// Ensure critical properties are set correctly for restored bots
@@ -190,14 +192,10 @@ namespace Managing.Application.ManageBot
bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
var stopMessage = $"🛑 **Bot Stopped**\n\n" +
$"┌─────────────────────────────┐\n" +
$"│ BOT STOPPED 🔴 │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Stopped At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
$"✅ **Bot has been safely stopped and is no longer active.**";
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Stopped At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$" **Bot has been safely stopped and is no longer active.**";
await _messengerService.SendTradeMessage(stopMessage, false, bot.User);
return bot.GetStatus();
@@ -219,14 +217,10 @@ namespace Managing.Application.ManageBot
bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
var deleteMessage = $"🗑️ **Bot Deleted**\n\n" +
$"┌─────────────────────────────┐\n" +
$"│ BOT DELETED ❌ │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Deleted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
$"⚠️ **Bot has been permanently deleted and all data removed.**";
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Deleted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"⚠️ **Bot has been permanently deleted and all data removed.**";
await _messengerService.SendTradeMessage(deleteMessage, false, bot.User);
}
@@ -251,16 +245,12 @@ namespace Managing.Application.ManageBot
if (botWrapper.BotInstance is IBot bot)
{
bot.Restart();
var restartMessage = $"🔄 **Bot Restarted**\n\n" +
$"┌─────────────────────────────┐\n" +
$"│ BOT RESTARTED 🟢 │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Restarted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
$"🚀 **Bot has been successfully restarted and is now active.**";
$"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Restarted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"🚀 **Bot has been successfully restarted and is now active.**";
await _messengerService.SendTradeMessage(restartMessage, false, bot.User);
return bot.GetStatus();
@@ -300,13 +290,15 @@ namespace Managing.Application.ManageBot
}
else
{
throw new ArgumentException($"Scenario '{newConfig.ScenarioName}' not found in database when updating configuration");
throw new ArgumentException(
$"Scenario '{newConfig.ScenarioName}' not found in database when updating configuration");
}
}
if (newConfig.Scenario == null)
{
throw new ArgumentException("Scenario object must be provided or ScenarioName must be valid when updating configuration");
throw new ArgumentException(
"Scenario object must be provided or ScenarioName must be valid when updating configuration");
}
// Check if the bot name is changing