Update bot messages
This commit is contained in:
@@ -188,6 +188,18 @@ namespace Managing.Application.ManageBot
|
||||
{
|
||||
await Task.Run(() =>
|
||||
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.**";
|
||||
|
||||
await _messengerService.SendTradeMessage(stopMessage, false, bot.User);
|
||||
return bot.GetStatus();
|
||||
}
|
||||
}
|
||||
@@ -205,6 +217,18 @@ namespace Managing.Application.ManageBot
|
||||
{
|
||||
await Task.Run(() =>
|
||||
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.**";
|
||||
|
||||
await _messengerService.SendTradeMessage(deleteMessage, false, bot.User);
|
||||
}
|
||||
|
||||
await _botRepository.DeleteBotBackup(identifier);
|
||||
@@ -220,18 +244,30 @@ namespace Managing.Application.ManageBot
|
||||
return false;
|
||||
}
|
||||
|
||||
public Task<string> RestartBot(string identifier)
|
||||
public async Task<string> RestartBot(string identifier)
|
||||
{
|
||||
if (_botTasks.TryGetValue(identifier, out var botWrapper))
|
||||
{
|
||||
if (botWrapper.BotInstance is IBot bot)
|
||||
{
|
||||
bot.Restart();
|
||||
return Task.FromResult(bot.GetStatus());
|
||||
|
||||
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.**";
|
||||
|
||||
await _messengerService.SendTradeMessage(restartMessage, false, bot.User);
|
||||
return bot.GetStatus();
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult(BotStatus.Down.ToString());
|
||||
return BotStatus.Down.ToString();
|
||||
}
|
||||
|
||||
public void ToggleIsForWatchingOnly(string identifier)
|
||||
|
||||
Reference in New Issue
Block a user