From cc9409b96aa9c555db42a9dd2cbf5ac1379b2a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Wed, 16 Jul 2025 11:00:33 -0400 Subject: [PATCH] bug: fixing application not exiting --- src/Nullinside.Api.TwitchBot/ChatRules/StreamRise.cs | 8 ++++---- .../Nullinside.Api.TwitchBot.csproj | 4 ++-- src/Nullinside.Api.TwitchBot/Services/MainService.cs | 9 +++++++++ src/nullinside-api | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Nullinside.Api.TwitchBot/ChatRules/StreamRise.cs b/src/Nullinside.Api.TwitchBot/ChatRules/StreamRise.cs index 58b2119..1f70b32 100644 --- a/src/Nullinside.Api.TwitchBot/ChatRules/StreamRise.cs +++ b/src/Nullinside.Api.TwitchBot/ChatRules/StreamRise.cs @@ -11,10 +11,10 @@ namespace Nullinside.Api.TwitchBot.ChatRules; /// public class StreamRise : AChatRule { private const string SPAM = "Hello, sorry for bothering you. I want to offer promotion of your channel, " + - "viewers, followers, views, chat bots, etc...The price is lower than any competitor, " + - "the quality is guaranteed to be the best. Flexible and convenient order management " + - "panel, chat panel, everything is in your hands, a huge number of custom settings. Go " + - "to streamrise"; + "viewers, followers, views, chat bots, etc...The price is lower than any competitor, " + + "the quality is guaranteed to be the best. Flexible and convenient order management " + + "panel, chat panel, everything is in your hands, a huge number of custom settings. Go " + + "to streamrise"; /// public override bool ShouldRun(TwitchUserConfig config) { diff --git a/src/Nullinside.Api.TwitchBot/Nullinside.Api.TwitchBot.csproj b/src/Nullinside.Api.TwitchBot/Nullinside.Api.TwitchBot.csproj index fcce0e0..cea75ed 100644 --- a/src/Nullinside.Api.TwitchBot/Nullinside.Api.TwitchBot.csproj +++ b/src/Nullinside.Api.TwitchBot/Nullinside.Api.TwitchBot.csproj @@ -24,14 +24,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Nullinside.Api.TwitchBot/Services/MainService.cs b/src/Nullinside.Api.TwitchBot/Services/MainService.cs index c5eecc6..80eee9a 100644 --- a/src/Nullinside.Api.TwitchBot/Services/MainService.cs +++ b/src/Nullinside.Api.TwitchBot/Services/MainService.cs @@ -99,9 +99,18 @@ public MainService(IServiceScopeFactory serviceScopeFactory) { _db = _scope.ServiceProvider.GetRequiredService(); _api = _scope.ServiceProvider.GetRequiredService(); _client = _scope.ServiceProvider.GetRequiredService(); + _client.AddDisconnectedCallback(OnTwitchClientDisconected); _chatMessageConsumer = new TwitchChatMessageMonitorConsumer(_db, _api, _receivedMessageProcessingQueue); } + /// + /// Called when the twitch client is disconnected. + /// + private void OnTwitchClientDisconected() { + _log.Info("Twitch Client Disconnected, exiting app"); + Environment.Exit(0); + } + /// /// The execute called by the .NET runtime. /// diff --git a/src/nullinside-api b/src/nullinside-api index 513c53b..ad4e87a 160000 --- a/src/nullinside-api +++ b/src/nullinside-api @@ -1 +1 @@ -Subproject commit 513c53bbf498fb7d3a86a4eb019433b8383140ee +Subproject commit ad4e87a4b780c459d365d76d89a1c72e3583c7bb