Fix stop/restart

This commit is contained in:
2025-07-10 12:53:59 +07:00
parent 0c1184a22d
commit 14b3a3c39a
9 changed files with 164 additions and 271 deletions

View File

@@ -116,14 +116,15 @@ public class TradingBot : Bot, ITradingBot
// Send startup message only for fresh starts (not reboots)
// Consider it a reboot if the bot was created more than 5 minutes ago
var timeSinceCreation = DateTime.UtcNow - CreateDate;
var isReboot = timeSinceCreation.TotalMinutes > 5;
var isReboot = timeSinceCreation.TotalMinutes > 3;
StartupTime = DateTime.UtcNow;
if (!isReboot)
{
try
{
StartupTime = DateTime.UtcNow;
var indicatorNames = Indicators.Select(i => i.Type.ToString()).ToList();
var startupMessage = $"🚀 **Bot Started Successfully!**\n\n" +
$"📊 **Trading Setup:**\n" +
@@ -157,6 +158,7 @@ public class TradingBot : Bot, ITradingBot
}
}
InitWorker(Run).GetAwaiter().GetResult();
}
@@ -1458,6 +1460,7 @@ public class TradingBot : Bot, ITradingBot
Identifier = backup.Identifier;
User = backup.User;
Status = backup.LastStatus;
StartupTime = data.StartupTime;
}
/// <summary>