mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-25 07:13:44 +03:00
filter forwarded messages, set api timeout to 100
This commit is contained in:
parent
a050dcaf08
commit
0efd433363
|
@ -7,7 +7,7 @@ from .icmp import icmp_cmd
|
||||||
|
|
||||||
|
|
||||||
def setup(dp: Dispatcher):
|
def setup(dp: Dispatcher):
|
||||||
dp.register_message_handler(start_cmd, commands=['start'])
|
dp.register_message_handler(start_cmd, is_forwarded=False, commands=['start'])
|
||||||
dp.register_message_handler(web_cmd, commands=['web', 'http'])
|
dp.register_message_handler(web_cmd, is_forwarded=False, commands=['web', 'http'])
|
||||||
dp.register_message_handler(whois_cmd, commands=['whois'])
|
dp.register_message_handler(whois_cmd, is_forwarded=False, commands=['whois'])
|
||||||
dp.register_message_handler(icmp_cmd, commands=['icmp'])
|
dp.register_message_handler(icmp_cmd, is_forwarded=False, commands=['icmp', 'ping'])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient, Timeout
|
||||||
from typing import List
|
from typing import List
|
||||||
from core.coretypes import APINode
|
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]):
|
async def send_api_requests(endpoint: str, data: dict, nodes: List[APINode]):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
data.update(dict(token=node.token))
|
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(
|
result = await client.get(
|
||||||
f"{node.address}/{endpoint}", params=data
|
f"{node.address}/{endpoint}", params=data
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user