mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Added separate restream shill message for commercial breaks
This commit is contained in:
@@ -40,7 +40,24 @@ public class SetRestreamCommand : ICommand
|
|||||||
await Helpers.SetValue(BuiltIn.Keys.RestreamUrl, arguments["url"].Value);
|
await Helpers.SetValue(BuiltIn.Keys.RestreamUrl, arguments["url"].Value);
|
||||||
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, updated URL", true);
|
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, updated URL", true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetShillRestreamCommand : ICommand
|
||||||
|
{
|
||||||
|
public List<Regex> Patterns => [
|
||||||
|
new Regex("^restream setshill (?<url>.+)$")
|
||||||
|
];
|
||||||
|
|
||||||
|
public string? HelpText => "Set restream shill URL";
|
||||||
|
public UserRight RequiredRight => UserRight.TrueAndHonest;
|
||||||
|
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
|
||||||
|
|
||||||
|
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||||
|
CancellationToken ctx)
|
||||||
|
{
|
||||||
|
await Helpers.SetValue(BuiltIn.Keys.TwitchCommercialRestreamShillMessage, arguments["url"].Value);
|
||||||
|
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, updated URL for the commercial break restream shill", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SelfPromoCommand : ICommand
|
public class SelfPromoCommand : ICommand
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ public class BotServices
|
|||||||
private void OnTwitchStreamCommercial(object sender, int channelId, int length, bool scheduled)
|
private void OnTwitchStreamCommercial(object sender, int channelId, int length, bool scheduled)
|
||||||
{
|
{
|
||||||
var settings = Helpers
|
var settings = Helpers
|
||||||
.GetMultipleValues([BuiltIn.Keys.TwitchShillRestreamOnCommercial, BuiltIn.Keys.RestreamUrl, BuiltIn.Keys.TwitchBossmanJackUsername]).Result;
|
.GetMultipleValues([BuiltIn.Keys.TwitchShillRestreamOnCommercial, BuiltIn.Keys.TwitchCommercialRestreamShillMessage, BuiltIn.Keys.TwitchBossmanJackUsername]).Result;
|
||||||
if (!settings[BuiltIn.Keys.TwitchShillRestreamOnCommercial].ToBoolean())
|
if (!settings[BuiltIn.Keys.TwitchShillRestreamOnCommercial].ToBoolean())
|
||||||
{
|
{
|
||||||
_logger.Debug("Not shilling as it's disabled");
|
_logger.Debug("Not shilling as it's disabled");
|
||||||
@@ -591,7 +591,7 @@ public class BotServices
|
|||||||
|
|
||||||
_chatBot.SendChatMessage(
|
_chatBot.SendChatMessage(
|
||||||
$"Did you just get a {length} second ad on Twitch? The Keno Kasino encourages Total Advertiser Death.[br]" +
|
$"Did you just get a {length} second ad on Twitch? The Keno Kasino encourages Total Advertiser Death.[br]" +
|
||||||
$"{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value} 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}",
|
$"{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value} streams are being re-streamed in low latency, ad-free form thanks to @Kees H. Do not watch ads.[br]{settings[BuiltIn.Keys.TwitchCommercialRestreamShillMessage].Value}",
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -840,6 +840,16 @@ public static class BuiltIn
|
|||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.FromHours(1),
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
ValueType = SettingValueType.Boolean
|
ValueType = SettingValueType.Boolean
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.TwitchCommercialRestreamShillMessage,
|
||||||
|
Regex = ".+",
|
||||||
|
Description = "The specific restream to shill when a commercial is detected if shilling is enabled",
|
||||||
|
Default = "No commercial restream shill message set",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
|
ValueType = SettingValueType.Text
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -908,5 +918,6 @@ public static class BuiltIn
|
|||||||
public static string BotToyStoryImage = "Bot.ToyStoryImage";
|
public static string BotToyStoryImage = "Bot.ToyStoryImage";
|
||||||
public static string BotImageRandomSliceDivideBy = "Bot.Image.RandomSliceDivideBy";
|
public static string BotImageRandomSliceDivideBy = "Bot.Image.RandomSliceDivideBy";
|
||||||
public static string BotToyStoryImageOnChrisDjLive = "Bot.ToyStoryImageOnChrisDjLive";
|
public static string BotToyStoryImageOnChrisDjLive = "Bot.ToyStoryImageOnChrisDjLive";
|
||||||
|
public static string TwitchCommercialRestreamShillMessage = "Twitch.CommercialRestreamShillMessage";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user