diff --git a/KfChatDotNetBot/Services/BotServices.cs b/KfChatDotNetBot/Services/BotServices.cs index daeb630..69f362c 100644 --- a/KfChatDotNetBot/Services/BotServices.cs +++ b/KfChatDotNetBot/Services/BotServices.cs @@ -175,6 +175,7 @@ public class BotServices _twitch = new Twitch([settings[BuiltIn.Keys.TwitchBossmanJackId].ToType()], settings[BuiltIn.Keys.Proxy].Value, _cancellationToken); _twitch.OnStreamStateUpdated += OnTwitchStreamStateUpdated; _twitch.OnStreamCommercial += OnTwitchStreamCommercial; + _twitch.OnStreamTosStrike += OnTwitchStreamTosStrike; await _twitch.StartWsClient(); _logger.Info("Built Twitch Websocket connection for livestream notifications"); } @@ -637,6 +638,12 @@ public class BotServices true); } + private void OnTwitchStreamTosStrike(object sender, int channelId) + { + var username = Helpers.GetValue(BuiltIn.Keys.TwitchBossmanJackUsername).Result; + _chatBot.SendChatMessage($":!::!: {username.Value} was just banned from Twitch! :!::!:", true); + } + private void OnChipsggRecentBet(object sender, ChipsggBetModel bet) { var settings = Helpers diff --git a/KfChatDotNetBot/Services/Twitch.cs b/KfChatDotNetBot/Services/Twitch.cs index fd6c4e2..e5cf671 100644 --- a/KfChatDotNetBot/Services/Twitch.cs +++ b/KfChatDotNetBot/Services/Twitch.cs @@ -18,8 +18,10 @@ public class Twitch : IDisposable private List _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");