Fixed a lot of compiler warnings. Fixed 7tv connection.
This commit is contained in:
@ -4,6 +4,7 @@ using CommonSocketLibrary.Abstract;
|
||||
using CommonSocketLibrary.Common;
|
||||
using HermesSocketLibrary.Socket.Data;
|
||||
using Serilog;
|
||||
using TwitchChatTTS.Bus;
|
||||
|
||||
namespace TwitchChatTTS.Hermes.Socket.Handlers
|
||||
{
|
||||
@ -11,13 +12,15 @@ namespace TwitchChatTTS.Hermes.Socket.Handlers
|
||||
{
|
||||
private readonly User _user;
|
||||
private readonly NightbotApiClient _nightbot;
|
||||
private readonly ServiceBusCentral _bus;
|
||||
private readonly ILogger _logger;
|
||||
public int OperationCode { get; } = 2;
|
||||
|
||||
public LoginAckHandler(User user, NightbotApiClient nightbot, ILogger logger)
|
||||
public LoginAckHandler(User user, NightbotApiClient nightbot, ServiceBusCentral bus, ILogger logger)
|
||||
{
|
||||
_user = user;
|
||||
_nightbot = nightbot;
|
||||
_bus = bus;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@ -51,6 +54,8 @@ namespace TwitchChatTTS.Hermes.Socket.Handlers
|
||||
_user.TwitchConnection = message.Connections.FirstOrDefault(c => c.Default && c.Type == "twitch");
|
||||
_user.NightbotConnection = message.Connections.FirstOrDefault(c => c.Default && c.Type == "nightbot");
|
||||
|
||||
_bus.Send(this, "twitch id", _user.TwitchUserId);
|
||||
|
||||
var filters = message.WordFilters.Where(f => f.Search != null && f.Replace != null).ToList();
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
|
@ -22,19 +22,19 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var policy = JsonSerializer.Deserialize<Policy>(json, _options);
|
||||
if (policy == null)
|
||||
{
|
||||
_logger.Warning($"Policy data failed: null");
|
||||
_logger.Warning($"Policy JSON data is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var group = _groups.Get(policy.GroupId.ToString());
|
||||
if (group == null)
|
||||
{
|
||||
_logger.Warning($"Policy data failed: group id not found [group id: {policy.GroupId}][policy id: {policy.Id}]");
|
||||
_logger.Warning($"Policy data is failed: group id not found [group id: {policy.GroupId}][policy id: {policy.Id}]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning($"Redeemable action JSON data received is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var action = JsonSerializer.Deserialize<RedeemableAction>(json, _options);
|
||||
if (action == null)
|
||||
{
|
||||
|
@ -19,8 +19,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning($"Redemption JSON data received is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var redemption = JsonSerializer.Deserialize<Redemption>(json, _options);
|
||||
if (redemption == null)
|
||||
{
|
||||
|
@ -19,8 +19,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning($"TTS Filter JSON data received is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var filter = JsonSerializer.Deserialize<TTSWordFilter>(json, _options);
|
||||
if (filter == null)
|
||||
{
|
||||
@ -40,7 +46,10 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
re.Match(string.Empty);
|
||||
filter.Regex = re;
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception)
|
||||
{
|
||||
_logger.Warning($"Failed to generate a Regular Expression using '{filter.Search}' [filter id: {filter.Id}]");
|
||||
}
|
||||
|
||||
_logger.Debug($"Filter data [filter id: {filter.Id}][search: {filter.Search}][replace: {filter.Replace}]");
|
||||
_user.RegexFilters.Add(filter);
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var data = json.Split('/');
|
||||
if (data.Length != 2)
|
||||
|
@ -15,7 +15,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -17,8 +17,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning("Chatters JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var chatters = JsonSerializer.Deserialize<IEnumerable<long>>(json, _options);
|
||||
if (chatters == null)
|
||||
{
|
||||
|
@ -29,8 +29,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Error("Connections JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var connections = JsonSerializer.Deserialize<IEnumerable<Connection>>(json, _options);
|
||||
if (connections == null)
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Text.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
@ -7,17 +6,15 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
{
|
||||
public string Name => "get_default_tts_voice";
|
||||
private readonly User _user;
|
||||
private readonly JsonSerializerOptions _options;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public GetDefaultTTSVoiceAck(User user, JsonSerializerOptions options, ILogger logger)
|
||||
public GetDefaultTTSVoiceAck(User user, ILogger logger)
|
||||
{
|
||||
_user = user;
|
||||
_options = options;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
string? defaultVoice = json;
|
||||
if (defaultVoice != null)
|
||||
|
@ -19,8 +19,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning("Emotes JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = JsonSerializer.Deserialize<IEnumerable<EmoteInfo>>(json, _options);
|
||||
if (data == null)
|
||||
{
|
||||
|
@ -17,8 +17,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Warning("TTS Voices JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var enabledTTSVoices = JsonSerializer.Deserialize<IEnumerable<string>>(json, _options);
|
||||
if (enabledTTSVoices == null)
|
||||
{
|
||||
|
@ -26,12 +26,18 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Error("Failed to load groups & permissions: JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var groupInfo = JsonSerializer.Deserialize<GroupInfo>(json, _options);
|
||||
if (groupInfo == null)
|
||||
{
|
||||
_logger.Error("Failed to load groups & permissions.");
|
||||
_logger.Error("Failed to load groups & permissions: object is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,18 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null)
|
||||
{
|
||||
_logger.Error($"No policies have been found: JSON is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var policies = JsonSerializer.Deserialize<IEnumerable<Policy>>(json, _options);
|
||||
if (policies == null || !policies.Any())
|
||||
{
|
||||
_logger.Error($"No policies have been found.");
|
||||
_logger.Error($"No policies have been found: object is null or empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
HermesRequestData? hermesRequestData = null;
|
||||
if (!string.IsNullOrEmpty(requestId))
|
||||
|
@ -18,7 +18,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var users = JsonSerializer.Deserialize<IDictionary<long, string>>(json, _options);
|
||||
if (users == null)
|
||||
|
@ -19,7 +19,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var voices = JsonSerializer.Deserialize<IEnumerable<TTSVoice>>(json, _options);
|
||||
if (voices == null)
|
||||
|
@ -19,7 +19,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var wordFilters = JsonSerializer.Deserialize<IEnumerable<TTSWordFilter>>(json, _options);
|
||||
if (wordFilters == null)
|
||||
|
@ -3,6 +3,6 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
public interface IRequestAck
|
||||
{
|
||||
string Name { get; }
|
||||
void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData);
|
||||
void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Fulfill(string type, string requestId, string data, IDictionary<string, object>? requestData)
|
||||
public void Fulfill(string type, string requestId, string? data, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (!_acknowledgements.TryGetValue(type, out var ack))
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var policy = JsonSerializer.Deserialize<Policy>(json, _options);
|
||||
if (policy == null)
|
||||
|
@ -19,7 +19,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var action = JsonSerializer.Deserialize<RedeemableAction>(json, _options);
|
||||
if (action == null)
|
||||
|
@ -19,8 +19,13 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (json == null) {
|
||||
_logger.Warning($"Redemption JSON data received is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var redemption = JsonSerializer.Deserialize<Redemption>(json, _options);
|
||||
if (redemption == null)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
var filter = JsonSerializer.Deserialize<TTSWordFilter>(json, _options);
|
||||
if (filter == null)
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
public void Acknowledge(string requestId, string? json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
if (requestData == null)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ namespace TwitchChatTTS.Hermes
|
||||
{
|
||||
public int MajorVersion { get; set; }
|
||||
public int MinorVersion { get; set; }
|
||||
public string Download { get; set; }
|
||||
public string Changelog { get; set; }
|
||||
public required string Download { get; set; }
|
||||
public required string Changelog { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user