Files
Solo_bot/middlewares/throttling.py
T
Zakhar Izmaylov 92889baa93 Delete Throttle
2025-01-12 18:19:49 +03:00

20 lines
502 B
Python

from collections.abc import Awaitable, Callable
from typing import Any
from aiogram import BaseMiddleware
from aiogram.types import TelegramObject
class ThrottleMiddleware(BaseMiddleware):
def __init__(self, limit: int):
self.limit = limit
async def __call__(
self,
handler: Callable[[TelegramObject, dict[str, Any]], Awaitable[Any]],
event: TelegramObject,
data: dict[str, Any],
) -> Any:
#todo
return await handler(event, data)