private static TwitchAPI CreateTwitchApi(ITwitchSettings twitchSettings, ILogger logger)
        {
            var apiSettings = new ApiSettings
            {
                ClientId = twitchSettings.ClientId
            };
            var loggerFactory = new LoggerFactory()
                                .AddSerilog(logger);

            return(new TwitchAPI(loggerFactory, settings: apiSettings));
        }
Beispiel #2
0
        private void AddTwitchBot(ITwitchSettings config)
        {
            if (Twitch != null)
            {
                return; // already created
            }
            if (string.IsNullOrWhiteSpace(config.TwitchChannel))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(config.TwitchUsername))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(config.TwitchToken))
            {
                return;
            }

            Twitch = new TwitchBot(config.TwitchUsername, config.TwitchToken, config.TwitchChannel, Hub);
            Hub.BotSync.BarrierReleasingActions.Add(() => Twitch.StartingDistribution(config.TwitchMessageStart));
        }
        public void ShouldRetrieveTwitchSettings()
        {
            ITwitchSettings twitchSettings = _configuration.GetValidatableOrThrow <TwitchSettings>();

            Assert.AreEqual("TestClientId", twitchSettings.ClientId);
        }