Fix bot things 2

This commit is contained in:
2025-02-11 02:06:35 +07:00
parent 898ff85eed
commit d7731dda0e
10 changed files with 164 additions and 121 deletions

View File

@@ -178,14 +178,22 @@ namespace Managing.Application.ManageBot
{
if (_botTasks.TryRemove(botName, out var botWrapper))
{
if (botWrapper.BotInstance is IBot bot)
try
{
await Task.Run(() =>
bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
}
if (botWrapper.BotInstance is IBot bot)
{
await Task.Run(() =>
bot.Stop()); // Assuming Stop is an asynchronous process wrapped in Task.Run for synchronous methods
}
_botRepository.DeleteBotBackup(botName);
return true;
await _botRepository.DeleteBotBackup(botName);
return true;
}
catch (Exception e)
{
Console.WriteLine(e);
return false;
}
}
return false;