From 40a452b8b7634df92c8a1f04f247c18282f0e84b Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Wed, 24 Sep 2025 01:20:54 -0500 Subject: [PATCH] Added a feature to force gamba messages even while live --- KfChatDotNetBot/Commands/AdminCommands.cs | 18 ++++++++++++++++++ KfChatDotNetBot/Services/BotServices.cs | 2 ++ 2 files changed, 20 insertions(+) diff --git a/KfChatDotNetBot/Commands/AdminCommands.cs b/KfChatDotNetBot/Commands/AdminCommands.cs index 64f0280..8a8011a 100644 --- a/KfChatDotNetBot/Commands/AdminCommands.cs +++ b/KfChatDotNetBot/Commands/AdminCommands.cs @@ -518,4 +518,22 @@ public class StartAlmanacCommand : ICommand botInstance.BotServices.AlmanacShill.StartShillTask(); await botInstance.SendChatMessageAsync("Asked it nicely to start", true); } +} + +public class ToggleForcedGambaMessagesCommand : ICommand +{ + public List Patterns => [ + new Regex("^admin toggle gamba") + ]; + + public string? HelpText => "Toggle forced gamba messages while a stream is running"; + public UserRight RequiredRight => UserRight.TrueAndHonest; + public TimeSpan Timeout => TimeSpan.FromSeconds(10); + public RateLimitOptionsModel? RateLimitOptions => null; + public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, + CancellationToken ctx) + { + botInstance.BotServices.TemporarilyForceGambaMessages = !botInstance.BotServices.TemporarilyForceGambaMessages; + await botInstance.SendChatMessageAsync($"TemporarilyForceGambaMessages is now {botInstance.BotServices.TemporarilyForceGambaMessages}", true); + } } \ No newline at end of file diff --git a/KfChatDotNetBot/Services/BotServices.cs b/KfChatDotNetBot/Services/BotServices.cs index 854a1ba..70d03cb 100644 --- a/KfChatDotNetBot/Services/BotServices.cs +++ b/KfChatDotNetBot/Services/BotServices.cs @@ -50,6 +50,7 @@ public class BotServices // lol internal bool TemporarilyBypassGambaSeshForDiscord; internal bool TemporarilySuppressGambaMessages = false; + internal bool TemporarilyForceGambaMessages = false; public BotServices(ChatBot botInstance, CancellationToken ctx) { @@ -1188,6 +1189,7 @@ public class BotServices public async Task CheckBmjIsLive() { + if (TemporarilyForceGambaMessages) return false; var isLive = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.TwitchGraphQlPersistedCurrentlyLive)).ToBoolean(); if (isLive || TemporarilySuppressGambaMessages)