Added a feature to shill the ad-free re-stream when a Twitch commercial break is detected

This commit is contained in:
barelyprofessional
2024-09-07 17:07:07 +08:00
parent 450f26f763
commit 2accae84cf
2 changed files with 27 additions and 0 deletions

View File

@@ -148,6 +148,7 @@ public class BotServices
}
_twitch = new Twitch([settings[BuiltIn.Keys.TwitchBossmanJackId].ToType<int>()], settings[BuiltIn.Keys.Proxy].Value, _cancellationToken);
_twitch.OnStreamStateUpdated += OnTwitchStreamStateUpdated;
_twitch.OnStreamCommercial += OnTwitchStreamCommercial;
await _twitch.StartWsClient();
_logger.Info("Built Twitch Websocket connection for livestream notifications");
}
@@ -555,6 +556,22 @@ public class BotServices
IsBmjLive = false;
}
private void OnTwitchStreamCommercial(object sender, int channelId, int length, bool scheduled)
{
var settings = Helpers
.GetMultipleValues([BuiltIn.Keys.TwitchShillRestreamOnCommercial, BuiltIn.Keys.RestreamUrl]).Result;
if (!settings[BuiltIn.Keys.TwitchShillRestreamOnCommercial].ToBoolean())
{
_logger.Debug("Not shilling as it's disabled");
return;
}
_chatBot.SendChatMessage(
$"Did you just get a {length} second ad on Twitch? The Kasino Kasino encourages Total Advertiser Death.[br]" +
$"Bossman streams are being re-streamed in low latency, ad-free form thanks to @Kees H. Do not watch ads.[br]{settings[BuiltIn.Keys.RestreamUrl].Value}",
true);
}
private void OnChipsggRecentBet(object sender, ChipsggBetModel bet)
{
var settings = Helpers