From e86a4d69be33b19fb082e7003b18229944e27b90 Mon Sep 17 00:00:00 2001 From: CrackmaticSoftware <248342529+CrackmaticSoftware@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:26:24 +0100 Subject: [PATCH] add ratelimitingoptions to dice game --- KfChatDotNetBot/Commands/Kasino/DiceCommand.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/KfChatDotNetBot/Commands/Kasino/DiceCommand.cs b/KfChatDotNetBot/Commands/Kasino/DiceCommand.cs index e6c62e6..92e00f1 100644 --- a/KfChatDotNetBot/Commands/Kasino/DiceCommand.cs +++ b/KfChatDotNetBot/Commands/Kasino/DiceCommand.cs @@ -20,7 +20,11 @@ public class DiceCommand : ICommand public string? HelpText => "!dice, roll the dice (not really, you roll between 0 - 100)"; public UserRight RequiredRight => UserRight.Loser; public TimeSpan Timeout => TimeSpan.FromSeconds(5); - public RateLimitOptionsModel? RateLimitOptions => null; + public RateLimitOptionsModel? RateLimitOptions => new() + { + MaxInvocations = 3, + Window = TimeSpan.FromSeconds(30) + }; private static double _houseEdge = 0.05; // house edge hack? are we doing perfect 50/50 games? @@ -52,6 +56,8 @@ public class DiceCommand : ICommand await SettingsProvider.GetMultipleValuesAsync([ BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor ]); + // print dice game slider + await botInstance.SendChatMessageAsync($"{ConstructDiceGameOutput(rolled)}",true, autoDeleteAfter: cleanupDelay); if (rolled > 0.5 + _houseEdge) { // you win dice