mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Added a feature to shill the ad-free re-stream when a Twitch commercial break is detected
This commit is contained in:
@@ -148,6 +148,7 @@ public class BotServices
|
|||||||
}
|
}
|
||||||
_twitch = new Twitch([settings[BuiltIn.Keys.TwitchBossmanJackId].ToType<int>()], settings[BuiltIn.Keys.Proxy].Value, _cancellationToken);
|
_twitch = new Twitch([settings[BuiltIn.Keys.TwitchBossmanJackId].ToType<int>()], settings[BuiltIn.Keys.Proxy].Value, _cancellationToken);
|
||||||
_twitch.OnStreamStateUpdated += OnTwitchStreamStateUpdated;
|
_twitch.OnStreamStateUpdated += OnTwitchStreamStateUpdated;
|
||||||
|
_twitch.OnStreamCommercial += OnTwitchStreamCommercial;
|
||||||
await _twitch.StartWsClient();
|
await _twitch.StartWsClient();
|
||||||
_logger.Info("Built Twitch Websocket connection for livestream notifications");
|
_logger.Info("Built Twitch Websocket connection for livestream notifications");
|
||||||
}
|
}
|
||||||
@@ -555,6 +556,22 @@ public class BotServices
|
|||||||
IsBmjLive = false;
|
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)
|
private void OnChipsggRecentBet(object sender, ChipsggBetModel bet)
|
||||||
{
|
{
|
||||||
var settings = Helpers
|
var settings = Helpers
|
||||||
|
|||||||
@@ -449,6 +449,15 @@ public static class BuiltIn
|
|||||||
Default = "[\"https://i.postimg.cc/QMzBRmH7/hiiiii.gif\"]",
|
Default = "[\"https://i.postimg.cc/QMzBRmH7/hiiiii.gif\"]",
|
||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.FromHours(1)
|
CacheDuration = TimeSpan.FromHours(1)
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.TwitchShillRestreamOnCommercial,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Whether to shill the ad-free restream on commercial",
|
||||||
|
Default = "true",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -491,5 +500,6 @@ public static class BuiltIn
|
|||||||
public static string RestreamUrl = "RestreamUrl";
|
public static string RestreamUrl = "RestreamUrl";
|
||||||
public static string KiwiFarmsCookies = "KiwiFarms.Cookies";
|
public static string KiwiFarmsCookies = "KiwiFarms.Cookies";
|
||||||
public static string BotGmKasinoImageRotation = "Bot.GmKasinoImageRotation";
|
public static string BotGmKasinoImageRotation = "Bot.GmKasinoImageRotation";
|
||||||
|
public static string TwitchShillRestreamOnCommercial = "Twitch.ShillRestreamOnCommercial";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user