mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-14 18:12:43 -04:00
Added support for the Twitch ToS strike packet and an alert for it
This commit is contained in:
@@ -18,8 +18,10 @@ public class Twitch : IDisposable
|
||||
private List<int> _channels;
|
||||
public delegate void OnStreamStateUpdateEventHandler(object sender, int channelId, bool isLive);
|
||||
public delegate void OnStreamCommercialEventHandler(object sender, int channelId, int length, bool scheduled);
|
||||
public delegate void OnStreamTosStrikeEventHandler(object sender, int channelId);
|
||||
public event OnStreamStateUpdateEventHandler OnStreamStateUpdated;
|
||||
public event OnStreamCommercialEventHandler OnStreamCommercial;
|
||||
public event OnStreamTosStrikeEventHandler OnStreamTosStrike;
|
||||
private CancellationToken _cancellationToken = CancellationToken.None;
|
||||
private Task? _pingTask = null;
|
||||
private CancellationTokenSource _pingCts = new();
|
||||
@@ -164,6 +166,13 @@ public class Twitch : IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
if (twitchMessage.GetProperty("type").GetString() == "tos-strike")
|
||||
{
|
||||
_logger.Info("Received a TOS strike packet");
|
||||
OnStreamTosStrike?.Invoke(this, channelId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (twitchMessage.GetProperty("type").GetString() == "commercial")
|
||||
{
|
||||
_logger.Info("Twitch commercial received");
|
||||
|
||||
Reference in New Issue
Block a user