diff --git a/src/Nullinside.Api.Common/Nullinside.Api.Common.csproj b/src/Nullinside.Api.Common/Nullinside.Api.Common.csproj index bb7261f..378fd55 100644 --- a/src/Nullinside.Api.Common/Nullinside.Api.Common.csproj +++ b/src/Nullinside.Api.Common/Nullinside.Api.Common.csproj @@ -17,10 +17,10 @@ - - + + - + diff --git a/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs b/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs index 9e8c408..2405138 100644 --- a/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs +++ b/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs @@ -29,6 +29,11 @@ public class TwitchClientProxy : ITwitchClientProxy { /// private static TwitchClientProxy? instance; + /// + /// The callback(s) to invoke when a new instance is created. + /// + private static Action? onInstanceCreated; + /// /// The list of chats we attempted to join with the bot. /// @@ -67,11 +72,6 @@ public class TwitchClientProxy : ITwitchClientProxy { /// The callback(s) to invoke when a channel receives a ban message. /// private Action? onUserBanReceived; - - /// - /// The callback(s) to invoke when a new instance is created. - /// - private static Action? onInstanceCreated; /// /// The web socket to connect to twitch chat with. @@ -170,17 +170,6 @@ public async Task AddMessageCallback(string channel, Action callback) { onMessageReceived -= callback; } - - /// - public void AddInstanceCallback(Action callback) { - onInstanceCreated -= callback; - onInstanceCreated += callback; - } - - /// - public void RemoveInstanceCallback(Action callback) { - onInstanceCreated -= callback; - } /// public async Task AddBannedCallback(string channel, Action callback) { @@ -214,6 +203,17 @@ public ValueTask DisposeAsync() { return ValueTask.CompletedTask; } + /// + public void AddInstanceCallback(Action callback) { + onInstanceCreated -= callback; + onInstanceCreated += callback; + } + + /// + public void RemoveInstanceCallback(Action callback) { + onInstanceCreated -= callback; + } + /// /// Joins a twitch channel. /// @@ -429,7 +429,7 @@ protected virtual void Dispose(bool disposing) { twitchChatClientReconnect?.Dispose(); socket?.Dispose(); } - + instance = null; } } \ No newline at end of file