Generalized the ChatMessageReader to make it work with ChannelResubscrition. Added connections refresh command.

This commit is contained in:
Tom
2024-08-12 19:45:17 +00:00
parent f503f7c6f4
commit 1d43515fb9
18 changed files with 182 additions and 135 deletions

View File

@@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection;
using Serilog;
using TwitchChatTTS.Hermes.Socket;
using TwitchChatTTS.OBS.Socket;
using TwitchChatTTS.Twitch.Socket;
using TwitchChatTTS.Twitch.Socket.Messages;
using static TwitchChatTTS.Chat.Commands.TTSCommands;
@@ -37,7 +36,8 @@ namespace TwitchChatTTS.Chat.Commands
.CreateStaticInputParameter("default_voice", b => b.CreateCommand(new RefreshTTSDefaultVoice()))
.CreateStaticInputParameter("redemptions", b => b.CreateCommand(new RefreshRedemptions()))
.CreateStaticInputParameter("obs_cache", b => b.CreateCommand(new RefreshObs(_obs, _logger)))
.CreateStaticInputParameter("permissions", b => b.CreateCommand(new RefreshPermissions()));
.CreateStaticInputParameter("permissions", b => b.CreateCommand(new RefreshPermissions()))
.CreateStaticInputParameter("connections", b => b.CreateCommand(new RefreshConnections()));
});
}
@@ -113,7 +113,6 @@ namespace TwitchChatTTS.Chat.Commands
private sealed class RefreshPermissions : IChatPartialCommand
{
public bool AcceptCustomPermission { get => true; }
public async Task Execute(IDictionary<string, string> values, ChannelChatMessage message, HermesSocketClient hermes)
@@ -121,5 +120,15 @@ namespace TwitchChatTTS.Chat.Commands
await hermes.FetchPermissions();
}
}
private sealed class RefreshConnections : IChatPartialCommand
{
public bool AcceptCustomPermission { get => true; }
public async Task Execute(IDictionary<string, string> values, ChannelChatMessage message, HermesSocketClient hermes)
{
await hermes.FetchConnections();
}
}
}
}