Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Nullinside.Api.Common/Nullinside.Api.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="log4net" Version="3.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
<PackageReference Include="log4net" Version="3.0.4"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="SSH.NET" Version="2025.0.0" />
<PackageReference Include="SSH.NET" Version="2025.0.0"/>
<PackageReference Include="TwitchLib.Api" Version="3.9.0"/>
<PackageReference Include="TwitchLib.Client" Version="3.3.1"/>
</ItemGroup>
Expand Down
34 changes: 17 additions & 17 deletions src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public class TwitchClientProxy : ITwitchClientProxy {
/// </summary>
private static TwitchClientProxy? instance;

/// <summary>
/// The callback(s) to invoke when a new instance is created.
/// </summary>
private static Action<TwitchClientProxy>? onInstanceCreated;

/// <summary>
/// The list of chats we attempted to join with the bot.
/// </summary>
Expand Down Expand Up @@ -67,11 +72,6 @@ public class TwitchClientProxy : ITwitchClientProxy {
/// The callback(s) to invoke when a channel receives a ban message.
/// </summary>
private Action<OnUserBannedArgs>? onUserBanReceived;

/// <summary>
/// The callback(s) to invoke when a new instance is created.
/// </summary>
private static Action<TwitchClientProxy>? onInstanceCreated;

/// <summary>
/// The web socket to connect to twitch chat with.
Expand Down Expand Up @@ -170,17 +170,6 @@ public async Task AddMessageCallback(string channel, Action<OnMessageReceivedArg
public void RemoveMessageCallback(Action<OnMessageReceivedArgs> callback) {
onMessageReceived -= callback;
}

/// <inheritdoc />
public void AddInstanceCallback(Action<TwitchClientProxy> callback) {
onInstanceCreated -= callback;
onInstanceCreated += callback;
}

/// <inheritdoc />
public void RemoveInstanceCallback(Action<TwitchClientProxy> callback) {
onInstanceCreated -= callback;
}

/// <inheritdoc />
public async Task AddBannedCallback(string channel, Action<OnUserBannedArgs> callback) {
Expand Down Expand Up @@ -214,6 +203,17 @@ public ValueTask DisposeAsync() {
return ValueTask.CompletedTask;
}

/// <inheritdoc />
public void AddInstanceCallback(Action<TwitchClientProxy> callback) {
onInstanceCreated -= callback;
onInstanceCreated += callback;
}

/// <inheritdoc />
public void RemoveInstanceCallback(Action<TwitchClientProxy> callback) {
onInstanceCreated -= callback;
}

/// <summary>
/// Joins a twitch channel.
/// </summary>
Expand Down Expand Up @@ -429,7 +429,7 @@ protected virtual void Dispose(bool disposing) {
twitchChatClientReconnect?.Dispose();
socket?.Dispose();
}

instance = null;
}
}