hermes-client/Twitch/Socket/Handlers/ChannelChatMessageHandler.cs

38 lines
1000 B
C#
Raw Normal View History

using Serilog;
2024-08-12 01:44:31 -04:00
using TwitchChatTTS.Chat.Messaging;
using TwitchChatTTS.Twitch.Socket.Messages;
namespace TwitchChatTTS.Twitch.Socket.Handlers
{
public class ChannelChatMessageHandler : ITwitchSocketHandler
{
public string Name => "channel.chat.message";
2024-08-12 01:44:31 -04:00
private readonly ChatMessageReader _reader;
private readonly Configuration _configuration;
private readonly ILogger _logger;
public ChannelChatMessageHandler(
2024-08-12 01:44:31 -04:00
ChatMessageReader reader,
Configuration configuration,
ILogger logger
)
{
2024-08-12 01:44:31 -04:00
_reader = reader;
_configuration = configuration;
_logger = logger;
}
2024-08-12 01:44:31 -04:00
public async Task Execute(TwitchWebsocketClient sender, object data)
{
if (sender == null)
return;
if (data is not ChannelChatMessage message)
return;
2024-08-12 01:44:31 -04:00
await _reader.Execute(sender, message);
}
}
}