public OBSServices( OBSWebsocket obs, IOptions <OBSConfig> obsConfig, INotifierMediatorService notifierMediatorService, ILogger <OBSServices> logger) { OBSClient = obs; _obsConfig = obsConfig.Value; _notifierMediatorService = notifierMediatorService; _logger = logger; SetupOBS(); }
public OBSServices( IServiceProvider services, IOptions <OBSConfig> obsConfig, INotifierMediatorService notifierMediatorService, ILoggerFactory loggerFactory ) { _obsConfig = obsConfig.Value; _services = services; _notifierMediatorService = notifierMediatorService; _logger = loggerFactory.CreateLogger <OBSServices>(); SetupOBS(); }
public TwitchBot( IOptions <TwitchConfig> config, IOptions <OBSConfig> obsConfig, ILogger <TwitchBot> logger, HubConnection hubConnection, HtmlSanitizer sanitizer, TwitchMemoryCache twitchMemoryCache, TwitchAPI twitchApi, IMapper mapper, OBSWebsocket obs, WLEDService wledService) { _config = config.Value ?? throw new MissingConfigException(); _hubConnection = hubConnection; _hubConnection.StartAsync(); _logger = logger; _sanitizer = sanitizer; _mapper = mapper; _cache = twitchMemoryCache.Cache; _obs = obs; _obsConfig = obsConfig.Value; _wledService = wledService; var credentials = new ConnectionCredentials( _config.Chat.BotName, _config.Chat.PasswordGeneratorToken); var clientOptions = new ClientOptions { MessagesAllowedInPeriod = 750, ThrottlingPeriod = TimeSpan.FromSeconds(30) }; _twitchApiClient = twitchApi; var customClient = new WebSocketClient(clientOptions); _client = new TwitchClient(customClient); _client.Initialize(credentials, _config.Chat.Channel); _client.OnConnected += ClientOnConnected; _client.OnJoinedChannel += ClientOnJoinedChannel; _client.OnChatCommandReceived += ClientOnChatCommandReceived; _client.OnMessageReceived += ClientOnMessageReceived; _client.Connect(); SetupOBS(); }