From d4d499aebd36de507b3ad606384d745bcd15d5ec Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:48:49 -0500 Subject: [PATCH] Added enable/disable for Krash and cleanup delay as a configurable value --- KfChatDotNetBot/Commands/Kasino/KrashCommand.cs | 17 ++++++++++++++++- KfChatDotNetBot/Settings/BuiltIn.cs | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/KfChatDotNetBot/Commands/Kasino/KrashCommand.cs b/KfChatDotNetBot/Commands/Kasino/KrashCommand.cs index 99a6b81..dab08de 100644 --- a/KfChatDotNetBot/Commands/Kasino/KrashCommand.cs +++ b/KfChatDotNetBot/Commands/Kasino/KrashCommand.cs @@ -28,8 +28,23 @@ public class KrashBetCommand : ICommand GroupCollection arguments, CancellationToken ctx) { + var settings = + await SettingsProvider.GetMultipleValuesAsync([ + BuiltIn.Keys.KasinoKrashEnabled, BuiltIn.Keys.KasinoKrashCleanupDelay, + BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay + ]); + var cleanupDelay = TimeSpan.FromMilliseconds(settings[BuiltIn.Keys.KasinoKrashCleanupDelay].ToType()); - var cleanupDelay = TimeSpan.FromSeconds(10); + var krashEnabled = settings[BuiltIn.Keys.KasinoKrashEnabled].ToBoolean(); + if (!krashEnabled) + { + var gameDisabledCleanupDelay = + TimeSpan.FromMilliseconds(settings[BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay].ToType()); + await botInstance.SendChatMessageAsync( + $"{user.FormatUsername()}, krash is currently disabled.", + true, autoDeleteAfter: gameDisabledCleanupDelay); + return; + } if (message is { IsWhisper: false, MessageUuid: not null }) { diff --git a/KfChatDotNetBot/Settings/BuiltIn.cs b/KfChatDotNetBot/Settings/BuiltIn.cs index 797284f..d7554f5 100644 --- a/KfChatDotNetBot/Settings/BuiltIn.cs +++ b/KfChatDotNetBot/Settings/BuiltIn.cs @@ -570,6 +570,10 @@ public static class BuiltIn public static string BotDiscordImpersonationDeleteAttempt = "Bot.DiscordImpersonation.DeleteAttempt"; [BuiltInSetting("What search strings the Homoglyphic searcher should look for", SettingValueType.Array, "[\"discord16.png\", \"mBossmanJack:\", \"mBossnanJack:\", \"mBosmanJack:\", \"by @KenoGPT at\"]")] public static string BotDiscordImpersonationSearchStrings = "Bot.DiscordImpersonation.SearchStrings"; + [BuiltInSetting("Whether krash is enabled", SettingValueType.Boolean, "true", BooleanRegex)] + public static string KasinoKrashEnabled = "Kasino.Krash.Enabled"; + [BuiltInSetting("Delay in milliseconds before cleaning up krash", SettingValueType.Text, "10000", WholeNumberRegex)] + public static string KasinoKrashCleanupDelay = "Kasino.Krash.CleanupDelay"; } }