mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-28 16:33:43 +03:00
rate limit for ipcalc handler
This commit is contained in:
parent
335074d693
commit
5ab4d79b6e
|
@ -96,6 +96,7 @@ class CheckerBaseHandler(SimpleCommandHandler):
|
|||
te = time()
|
||||
logger.info(f"func {__name__} took {te - ts} sec")
|
||||
|
||||
# TODO: Validation classes
|
||||
async def validate_target(self, target: str):
|
||||
if validate_local(target):
|
||||
raise LocalhostForbidden()
|
||||
|
|
|
@ -3,6 +3,7 @@ from typing import Union
|
|||
import ipaddress
|
||||
|
||||
from tgbot.handlers.base import SimpleCommandHandler, NotEnoughArgs
|
||||
from tgbot.middlewares.throttling import rate_limit
|
||||
|
||||
ipcalc_help_message = """
|
||||
❓ Калькулятор IP подсетей.
|
||||
|
@ -20,6 +21,7 @@ class IPCalcCommandHandler(SimpleCommandHandler):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@rate_limit
|
||||
async def handler(self, message: Message):
|
||||
try:
|
||||
args = await self.process_args(message.text)
|
||||
|
|
Loading…
Reference in New Issue
Block a user