From ab28e625721ffc3732e2f04d82ae9287d695e4ff Mon Sep 17 00:00:00 2001 From: Ronny Gunawan <3048897+ronnygunawan@users.noreply.github.com> Date: Sun, 4 Feb 2024 21:40:57 +0700 Subject: [PATCH] Rate limit per user instead of per chat --- BotNet.CommandHandlers/AI/Gemini/GeminiTextPromptHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BotNet.CommandHandlers/AI/Gemini/GeminiTextPromptHandler.cs b/BotNet.CommandHandlers/AI/Gemini/GeminiTextPromptHandler.cs index 0a94135..fa5c6ee 100644 --- a/BotNet.CommandHandlers/AI/Gemini/GeminiTextPromptHandler.cs +++ b/BotNet.CommandHandlers/AI/Gemini/GeminiTextPromptHandler.cs @@ -23,8 +23,8 @@ public sealed class GeminiTextPromptHandler( ICommandQueue commandQueue, ILogger logger ) : ICommandHandler { - internal static readonly RateLimiter CHAT_RATE_LIMITER = RateLimiter.PerChat(5, TimeSpan.FromMinutes(5)); - internal static readonly RateLimiter VIP_CHAT_RATE_LIMITER = RateLimiter.PerChat(5, TimeSpan.FromMinutes(2)); + internal static readonly RateLimiter CHAT_RATE_LIMITER = RateLimiter.PerUserPerChat(5, TimeSpan.FromMinutes(5)); + internal static readonly RateLimiter VIP_CHAT_RATE_LIMITER = RateLimiter.PerUserPerChat(5, TimeSpan.FromMinutes(2)); private readonly ITelegramBotClient _telegramBotClient = telegramBotClient; private readonly GeminiClient _geminiClient = geminiClient;