Add MasterBot configuration properties to TradingBotBase and ensure MasterBotUserId preservation in RestartBotCommandHandler

- Introduced IsForCopyTrading, MasterBotIdentifier, and MasterBotUserId properties in TradingBotBase for enhanced bot configuration.
- Updated RestartBotCommandHandler to preserve MasterBotUserId from the database bot configuration.
This commit is contained in:
2025-11-22 15:42:17 +07:00
parent bd4d6be8d9
commit 461a73a8e3
2 changed files with 9 additions and 0 deletions

View File

@@ -2650,6 +2650,9 @@ public class TradingBotBase : ITradingBot
UseForSignalFiltering = Config.UseForSignalFiltering, UseForSignalFiltering = Config.UseForSignalFiltering,
UseForDynamicStopLoss = Config.UseForDynamicStopLoss, UseForDynamicStopLoss = Config.UseForDynamicStopLoss,
RiskManagement = Config.RiskManagement, RiskManagement = Config.RiskManagement,
IsForCopyTrading = Config.IsForCopyTrading,
MasterBotIdentifier = Config.MasterBotIdentifier,
MasterBotUserId = Config.MasterBotUserId,
}; };
} }

View File

@@ -50,6 +50,12 @@ namespace Managing.Application.ManageBot
throw new InvalidOperationException($"Could not retrieve configuration for bot {request.Identifier}"); throw new InvalidOperationException($"Could not retrieve configuration for bot {request.Identifier}");
} }
// Ensure MasterBotUserId is preserved from the database bot
if (bot.MasterBotUserId.HasValue && botConfig.MasterBotUserId != bot.MasterBotUserId.Value)
{
botConfig.MasterBotUserId = bot.MasterBotUserId.Value;
}
// Get account to check GMX initialization status // Get account to check GMX initialization status
Account account; Account account;
if (string.IsNullOrEmpty(botConfig.AccountName)) if (string.IsNullOrEmpty(botConfig.AccountName))