feat: Bot management improvements with wallet configuration and duplicate detection

This commit is contained in:
2025-10-10 12:34:00 +01:00
parent 91000035f5
commit 7008a95df3
9 changed files with 408 additions and 13 deletions

View File

@@ -99,6 +99,27 @@ public class BotService : IBotService
return bot != null ? MapToDto(bot) : null;
}
public async Task<BotDto?> GetBotByPlatformUsernameAsync(int platformType, string platformUsername)
{
try
{
var bot = await _context.Bots
.Include(b => b.Sessions)
.Include(b => b.Metrics)
.FirstOrDefaultAsync(b =>
b.Type == (BotType)platformType &&
b.PlatformUsername == platformUsername &&
b.Status != BotStatus.Deleted);
return bot != null ? MapToDto(bot) : null;
}
catch (Microsoft.Data.Sqlite.SqliteException ex) when (ex.Message.Contains("no such table"))
{
// Tables don't exist yet - return null
return null;
}
}
public async Task<IEnumerable<BotDto>> GetAllBotsAsync()
{
try

View File

@@ -12,6 +12,7 @@ public interface IBotService
Task<BotDto?> AuthenticateBotAsync(string botKey);
Task<BotDto?> GetBotByIdAsync(Guid id);
Task<BotDto?> GetBotByKeyAsync(string botKey);
Task<BotDto?> GetBotByPlatformUsernameAsync(int platformType, string platformUsername);
Task<IEnumerable<BotDto>> GetAllBotsAsync();
Task<IEnumerable<BotDto>> GetActiveBots();
Task<bool> UpdateBotSettingsAsync(Guid botId, UpdateBotSettingsDto dto);