using System.Text.Json; using Serilog; namespace TwitchChatTTS.Hermes.Socket.Requests { public class GetChatterIdsAck : IRequestAck { public string Name => "get_chatter_ids"; private readonly User _user; private readonly JsonSerializerOptions _options; private readonly ILogger _logger; public GetChatterIdsAck(User user, JsonSerializerOptions options, ILogger logger) { _user = user; _options = options; _logger = logger; } public void Acknowledge(string requestId, string json, IDictionary? requestData) { var chatters = JsonSerializer.Deserialize>(json, _options); if (chatters == null) { _logger.Warning("Chatters is null."); return; } if (!chatters.Any()) { _logger.Warning("Chatters is empty."); return; } _user.Chatters = [.. chatters]; _logger.Information($"Fetched chatters [count: {chatters.Count()}]"); } } }