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,13 +192,9 @@ 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" +
$"│ BOT STOPPED 🔴 │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Stopped At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\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.**"; $"✅ **Bot has been safely stopped and is no longer active.**";
await _messengerService.SendTradeMessage(stopMessage, false, bot.User); await _messengerService.SendTradeMessage(stopMessage, false, bot.User);
@@ -219,13 +217,9 @@ 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" +
$"│ BOT DELETED ❌ │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Deleted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" + $"⏰ **Deleted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
$"⚠️ **Bot has been permanently deleted and all data removed.**"; $"⚠️ **Bot has been permanently deleted and all data removed.**";
await _messengerService.SendTradeMessage(deleteMessage, false, bot.User); await _messengerService.SendTradeMessage(deleteMessage, false, bot.User);
@@ -253,13 +247,9 @@ namespace Managing.Application.ManageBot
bot.Restart(); bot.Restart();
var restartMessage = $"🔄 **Bot Restarted**\n\n" + var restartMessage = $"🔄 **Bot Restarted**\n\n" +
$"┌─────────────────────────────┐\n" +
$"│ BOT RESTARTED 🟢 │\n" +
$"└─────────────────────────────┘\n\n" +
$"🎯 **Agent:** {bot.User.AgentName}\n" + $"🎯 **Agent:** {bot.User.AgentName}\n" +
$"🤖 **Bot Name:** {bot.Name}\n" + $"🤖 **Bot Name:** {bot.Name}\n" +
$"⏰ **Restarted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" + $"⏰ **Restarted At:** {DateTime.UtcNow:MMM dd, yyyy • HH:mm:ss} UTC\n\n" +
$"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
$"🚀 **Bot has been successfully restarted and is now active.**"; $"🚀 **Bot has been successfully restarted and is now active.**";
await _messengerService.SendTradeMessage(restartMessage, false, bot.User); await _messengerService.SendTradeMessage(restartMessage, false, bot.User);
@@ -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