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 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) 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 // 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 bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
var stopMessage = $"🛑 **Bot Stopped**\n\n" + var stopMessage = $"🛑 **Bot Stopped**\n\n" +
$"┌─────────────────────────────┐\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"│ BOT STOPPED 🔴 │\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"└─────────────────────────────┘\n\n" + $"⏰ **Stopped At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $" **Bot has been safely stopped and is no longer active.**";
$"🤖 **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.**";
await _messengerService.SendTradeMessage(stopMessage, false, bot.User); await _messengerService.SendTradeMessage(stopMessage, false, bot.User);
return bot.GetStatus(); 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 bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
var deleteMessage = $"🗑️ **Bot Deleted**\n\n" + var deleteMessage = $"🗑️ **Bot Deleted**\n\n" +
$"┌─────────────────────────────┐\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"│ BOT DELETED ❌ │\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"└─────────────────────────────┘\n\n" + $"⏰ **Deleted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $"⚠️ **Bot has been permanently deleted and all data removed.**";
$"🤖 **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.**";
await _messengerService.SendTradeMessage(deleteMessage, false, bot.User); await _messengerService.SendTradeMessage(deleteMessage, false, bot.User);
} }
@@ -251,16 +245,12 @@ namespace Managing.Application.ManageBot
if (botWrapper.BotInstance is IBot bot) if (botWrapper.BotInstance is IBot bot)
{ {
bot.Restart(); bot.Restart();
var restartMessage = $"🔄 **Bot Restarted**\n\n" + var restartMessage = $"🔄 **Bot Restarted**\n\n" +
$"┌─────────────────────────────┐\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"│ BOT RESTARTED 🟢 │\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"└─────────────────────────────┘\n\n" + $"⏰ **Restarted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $"🚀 **Bot has been successfully restarted and is now active.**";
$"🤖 **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.**";
await _messengerService.SendTradeMessage(restartMessage, false, bot.User); await _messengerService.SendTradeMessage(restartMessage, false, bot.User);
return bot.GetStatus(); return bot.GetStatus();
@@ -300,13 +290,15 @@ namespace Managing.Application.ManageBot
} }
else 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) 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 // Check if the bot name is changing