mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
Added enable/disable for Krash and cleanup delay as a configurable value
This commit is contained in:
@@ -28,8 +28,23 @@ public class KrashBetCommand : ICommand
|
|||||||
GroupCollection arguments,
|
GroupCollection arguments,
|
||||||
CancellationToken ctx)
|
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 })
|
if (message is { IsWhisper: false, MessageUuid: not null })
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -570,6 +570,10 @@ public static class BuiltIn
|
|||||||
public static string BotDiscordImpersonationDeleteAttempt = "Bot.DiscordImpersonation.DeleteAttempt";
|
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\"]")]
|
[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";
|
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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user