using TwitchChatTTS.OBS.Socket.Manager; using TwitchChatTTS.OBS.Socket; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.DependencyInjection; using TwitchChatTTS; using CommonSocketLibrary.Abstract; using CommonSocketLibrary.Common; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using TwitchChatTTS.Seven.Socket; using TwitchChatTTS.OBS.Socket.Handlers; using TwitchChatTTS.Seven.Socket.Handlers; using TwitchLib.Client.Interfaces; using TwitchLib.Client; using TwitchLib.PubSub.Interfaces; using TwitchLib.PubSub; using TwitchLib.Communication.Interfaces; using TwitchChatTTS.Seven.Socket.Managers; using TwitchChatTTS.Hermes.Socket.Handlers; using TwitchChatTTS.Hermes.Socket; using TwitchChatTTS.Hermes.Socket.Managers; using TwitchChatTTS.Chat.Commands.Parameters; using TwitchChatTTS.Chat.Commands; using System.Text.Json; using Serilog; using Serilog.Events; using Serilog.Sinks.SystemConsole.Themes; using TwitchChatTTS.Twitch.Redemptions; using TwitchChatTTS.Chat.Groups.Permissions; using TwitchChatTTS.Chat.Groups; using TwitchChatTTS.Chat.Emotes; using HermesSocketLibrary.Requests.Callbacks; using static TwitchChatTTS.Chat.Commands.TTSCommands; // dotnet publish -r linux-x64 -p:PublishSingleFile=true --self-contained true // dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true // SE voices: https://api.streamelements.com/kappa/v2/speech?voice=brian&text=hello HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); var s = builder.Services; var deserializer = new DeserializerBuilder() .IgnoreUnmatchedProperties() .WithNamingConvention(HyphenatedNamingConvention.Instance) .Build(); var configContent = File.ReadAllText("tts.config.yml"); var configuration = deserializer.Deserialize(configContent); s.AddSingleton(configuration); var logger = new LoggerConfiguration() .MinimumLevel.Verbose() //.MinimumLevel.Override("TwitchLib.Communication.Clients.WebSocketClient", LogEventLevel.Warning) //.MinimumLevel.Override("TwitchLib.PubSub.TwitchPubSub", LogEventLevel.Warning) .MinimumLevel.Override("TwitchLib", LogEventLevel.Warning) .MinimumLevel.Override("mariuszgromada", LogEventLevel.Error) .Enrich.FromLogContext() .WriteTo.File("logs/log-.log", restrictedToMinimumLevel: LogEventLevel.Debug, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 3) .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information, theme: SystemConsoleTheme.Colored) .CreateLogger(); s.AddSerilog(logger); s.AddSingleton(new User()); s.AddSingleton, CallbackManager>(); s.AddSingleton(new JsonSerializerOptions() { PropertyNameCaseInsensitive = false, PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower }); // Command parameters s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddTransient(); s.AddTransient(); s.AddTransient(); s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); // OBS websocket s.AddKeyedSingleton("obs"); s.AddKeyedSingleton("obs"); s.AddKeyedSingleton("obs"); s.AddKeyedSingleton("obs"); s.AddKeyedSingleton("obs"); s.AddKeyedSingleton, OBSMessageTypeManager>("obs"); s.AddKeyedSingleton, OBSSocketClient>("obs"); // 7tv websocket s.AddKeyedSingleton("7tv"); s.AddKeyedSingleton("7tv"); s.AddKeyedSingleton("7tv"); s.AddKeyedSingleton("7tv"); s.AddKeyedSingleton("7tv"); s.AddKeyedSingleton, SevenMessageTypeManager>("7tv"); s.AddKeyedSingleton, SevenSocketClient>("7tv"); // hermes websocket s.AddKeyedSingleton("hermes"); s.AddKeyedSingleton("hermes"); s.AddKeyedSingleton("hermes"); //s.AddKeyedSingleton("hermes"); s.AddKeyedSingleton, HermesMessageTypeManager>("hermes"); s.AddKeyedSingleton, HermesSocketClient>("hermes"); s.AddHostedService(); using IHost host = builder.Build(); await host.RunAsync();