public void Dispose()
 {
     if (_twitchChannelLinkProvider != null)
     {
         _twitchChannelLinkProvider.Dispose();
         _twitchChannelLinkProvider = null;
     }
 }
Exemplo n.º 2
0
        public static IApplicationBuilder UseTwitch(this IApplicationBuilder app)
        {
            // get application to dispose and close connections on shutdown
            IApplicationLifetime life = app.ApplicationServices.GetService <IApplicationLifetime>();

            ITwitchChannelLinkProvider twitchChannelLinkProvider = app.ApplicationServices.GetRequiredService <ITwitchChannelLinkProvider>();

            // handle life time jobs
            life.ApplicationStarted.Register(async() => await twitchChannelLinkProvider.StartAsync().ConfigureAwait(false));
            life.ApplicationStopping.Register(async() => await twitchChannelLinkProvider.StopAsync().ConfigureAwait(false));

            return(app);
        }
 public TwitchChatBotApp(ITwitchChannelLinkProvider twitchChannelLinkProvider)
 {
     _twitchChannelLinkProvider = twitchChannelLinkProvider;
 }