Skip to content

Commit

Permalink
fix bot ratelimit middleware
Browse files Browse the repository at this point in the history
Signed-off-by: fadhil riyanto <[email protected]>
  • Loading branch information
fadhil-riyanto committed Jan 29, 2025
1 parent 7e410b4 commit b91a469
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/middleware/rateLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const rateLimit: MiddlewareHandler = async (ctx, next) => {
return next();
}

if (userLimit.count >= limit) {
if (userLimit.count >= limit && ctx.msg?.chat.type == "private") {
const timeLeft = Math.ceil((userLimit.resetTime - now) / 1000);
await ctx.reply(`Rate limit exceeded. Please wait ${timeLeft} seconds.`);
return;
Expand Down

0 comments on commit b91a469

Please sign in to comment.