diff --git a/src/Managing.Application/Accounts/AccountService.cs b/src/Managing.Application/Accounts/AccountService.cs index 3f94dd6..0ec9216 100644 --- a/src/Managing.Application/Accounts/AccountService.cs +++ b/src/Managing.Application/Accounts/AccountService.cs @@ -14,6 +14,7 @@ public class AccountService : IAccountService private readonly IEvmManager _evmManager; private readonly ICacheService _cacheService; private readonly IWeb3ProxyService _web3ProxyService; + private readonly IUserRepository _userRepository; private readonly ILogger _logger; public AccountService( @@ -22,7 +23,8 @@ public class AccountService : IAccountService IExchangeService exchangeService, IEvmManager evmManager, ICacheService cacheService, - IWeb3ProxyService web3ProxyService) + IWeb3ProxyService web3ProxyService, + IUserRepository userRepository) { _accountRepository = accountRepository; _logger = logger; @@ -30,6 +32,7 @@ public class AccountService : IAccountService _evmManager = evmManager; _cacheService = cacheService; _web3ProxyService = web3ProxyService; + _userRepository = userRepository; } public async Task CreateAccount(User user, Account request) @@ -99,6 +102,8 @@ public class AccountService : IAccountService var account = await _accountRepository.GetAccountByNameAsync(name); ManageProperties(hideSecrets, getBalance, account); + account.User = await _userRepository.GetUserByNameAsync(account.User.Name); + return account; } diff --git a/src/Managing.Application/Bots/TradingBot.cs b/src/Managing.Application/Bots/TradingBot.cs index 967bad7..cbcdc43 100644 --- a/src/Managing.Application/Bots/TradingBot.cs +++ b/src/Managing.Application/Bots/TradingBot.cs @@ -1353,9 +1353,10 @@ public class TradingBot : Bot, ITradingBot { if (!Config.IsForBacktest) { + var user = Account.User; // Add bot name at the top of every message - var messageWithBotName = $"🤖 **{Name}**\n{message}"; - await MessengerService.SendTradeMessage(messageWithBotName, isBadBehavior, Account?.User); + var messageWithBotName = $"🤖 **{user.AgentName} - {Name}**\n{message}"; + await MessengerService.SendTradeMessage(messageWithBotName, isBadBehavior, user); } }