feat: Bot management improvements with wallet configuration and duplicate detection
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user