filter forwarded messages, set api timeout to 100

This commit is contained in:
kiriharu 2021-01-04 22:03:04 +03:00
parent a050dcaf08
commit 0efd433363
2 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from .icmp import icmp_cmd
def setup(dp: Dispatcher):
dp.register_message_handler(start_cmd, commands=['start'])
dp.register_message_handler(web_cmd, commands=['web', 'http'])
dp.register_message_handler(whois_cmd, commands=['whois'])
dp.register_message_handler(icmp_cmd, commands=['icmp'])
dp.register_message_handler(start_cmd, is_forwarded=False, commands=['start'])
dp.register_message_handler(web_cmd, is_forwarded=False, commands=['web', 'http'])
dp.register_message_handler(whois_cmd, is_forwarded=False, commands=['whois'])
dp.register_message_handler(icmp_cmd, is_forwarded=False, commands=['icmp', 'ping'])

View File

@ -1,4 +1,4 @@
from httpx import AsyncClient
from httpx import AsyncClient, Timeout
from typing import List
from core.coretypes import APINode
@ -15,7 +15,7 @@ def check_int(value) -> bool:
async def send_api_requests(endpoint: str, data: dict, nodes: List[APINode]):
for node in nodes:
data.update(dict(token=node.token))
async with AsyncClient() as client:
async with AsyncClient(timeout=Timeout(timeout=100.0)) as client:
result = await client.get(
f"{node.address}/{endpoint}", params=data
)