Added enable/disable for Krash and cleanup delay as a configurable value

This commit is contained in:
barelyprofessional
2026-04-09 20:48:49 -05:00
parent 9e921d5ff9
commit d4d499aebd
2 changed files with 20 additions and 1 deletions

View File

@@ -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<int>());
var cleanupDelay = TimeSpan.FromSeconds(10);
var krashEnabled = settings[BuiltIn.Keys.KasinoKrashEnabled].ToBoolean();
if (!krashEnabled)
{
var gameDisabledCleanupDelay =
TimeSpan.FromMilliseconds(settings[BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay].ToType<int>());
await botInstance.SendChatMessageAsync(
$"{user.FormatUsername()}, krash is currently disabled.",
true, autoDeleteAfter: gameDisabledCleanupDelay);
return;
}
if (message is { IsWhisper: false, MessageUuid: not null })
{

View File

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