diff --git a/KfChatDotNetBot/Commands/AdminCommands.cs b/KfChatDotNetBot/Commands/AdminCommands.cs index 95cbb5e..991c450 100644 --- a/KfChatDotNetBot/Commands/AdminCommands.cs +++ b/KfChatDotNetBot/Commands/AdminCommands.cs @@ -388,4 +388,20 @@ public class RemoveCourtHearingCommand : ICommand await Helpers.SetValueAsJsonObject(BuiltIn.Keys.BotCourtCalendar, hearings); await botInstance.SendChatMessageAsync("Updated list of hearings", true); } +} + +public class NonceLiveCommand : ICommand +{ + public List Patterns => [ + new Regex(@"^admin togglenonce$") + ]; + + public string? HelpText => "Toggle IsChrisDjLive"; + 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) + { + botInstance.BotServices.IsChrisDjLive = !botInstance.BotServices.IsChrisDjLive; + await botInstance.SendChatMessageAsync($"IsChrisDjLive => {botInstance.BotServices.IsChrisDjLive}", true); + } } \ No newline at end of file diff --git a/KfChatDotNetBot/Services/BotServices.cs b/KfChatDotNetBot/Services/BotServices.cs index 7ff31df..9f30db4 100644 --- a/KfChatDotNetBot/Services/BotServices.cs +++ b/KfChatDotNetBot/Services/BotServices.cs @@ -36,6 +36,7 @@ public class BotServices private string? _lastDiscordStatus; internal bool IsBmjLive = false; private bool _isBmjLiveSynced = false; + internal bool IsChrisDjLive = false; // lol internal bool TemporarilyBypassGambaSeshForDiscord = false; @@ -561,12 +562,16 @@ public class BotServices private void OnTwitchStreamStateUpdated(object sender, int channelId, bool isLive) { _logger.Info($"BossmanJack stream event came in. isLive => {isLive}"); - var settings = Helpers.GetMultipleValues([BuiltIn.Keys.RestreamUrl, BuiltIn.Keys.TwitchBossmanJackUsername]).Result; + var settings = Helpers.GetMultipleValues([BuiltIn.Keys.RestreamUrl, BuiltIn.Keys.TwitchBossmanJackUsername, BuiltIn.Keys.BotToyStoryImage]).Result; if (isLive) { _chatBot.SendChatMessage($"{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value} just went live on Twitch! https://www.twitch.tv/{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value}\r\n" + settings[BuiltIn.Keys.RestreamUrl].Value); + if (IsChrisDjLive) + { + _chatBot.SendChatMessage($"[img]{settings[BuiltIn.Keys.BotToyStoryImage].Value}[/img]", true); + } IsBmjLive = true; return; } @@ -677,7 +682,8 @@ public class BotServices private void OnStreamerIsLive(object sender, KickModels.StreamerIsLiveEventModel? e) { if (e == null) return; - var channels = Helpers.GetValue(BuiltIn.Keys.KickChannels).Result.JsonDeserialize>(); + var settings = Helpers.GetMultipleValues([BuiltIn.Keys.KickChannels, BuiltIn.Keys.BotToyStoryImage]).Result; + var channels = settings[BuiltIn.Keys.KickChannels].JsonDeserialize>(); if (channels == null) { _logger.Error("Caught null when grabbing Kick channels"); @@ -701,6 +707,12 @@ public class BotServices _chatBot.SendChatMessage( $"@{user.KfUsername} is live! {e.Livestream.SessionTitle} https://kick.com/{channel.ChannelSlug}", true); + + if (channel.ChannelSlug == "christopherdj") + { + IsChrisDjLive = true; + _chatBot.SendChatMessage($"[img]{settings[BuiltIn.Keys.BotToyStoryImage].Value}[/img]", true); + } } private void OnStopStreamBroadcast(object sender, KickModels.StopStreamBroadcastEventModel? e) @@ -730,5 +742,6 @@ public class BotServices _chatBot.SendChatMessage( $"@{user.KfUsername} is no longer live! :lossmanjack:", true); + if (channel.ChannelSlug == "christopherdj") IsChrisDjLive = false; } } \ No newline at end of file diff --git a/KfChatDotNetBot/Settings/BuiltIn.cs b/KfChatDotNetBot/Settings/BuiltIn.cs index 69bdb17..72c369f 100644 --- a/KfChatDotNetBot/Settings/BuiltIn.cs +++ b/KfChatDotNetBot/Settings/BuiltIn.cs @@ -711,10 +711,18 @@ public static class BuiltIn Description = "Whether the Rainbet integration is enabled at all", Default = "false", IsSecret = false, - CacheDuration = TimeSpan.FromHours(1) CacheDuration = TimeSpan.FromHours(1), ValueType = SettingValueType.Boolean }, + new BuiltInSettingsModel + { + Key = Keys.BotToyStoryImage, + Regex = ".+", + Description = "Image to use for the Toy Story joke", + Default = "https://i.ibb.co/603dk32R/nonce-drop.png", + IsSecret = false, + CacheDuration = TimeSpan.FromHours(1), + ValueType = SettingValueType.Text } ]; @@ -779,5 +787,6 @@ public static class BuiltIn public static string HowlggEnabled = "Howlgg.Enabled"; public static string ChipsggEnabled = "Chipsgg.Enabled"; public static string RainbetEnabled = "Rainbet.Enabled"; + public static string BotToyStoryImage = "Bot.ToyStoryImage"; } } \ No newline at end of file