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"; } }