diff --git a/apps/core/core/coretypes.py b/apps/core/core/coretypes.py index e8bf1c6..b53c3e4 100644 --- a/apps/core/core/coretypes.py +++ b/apps/core/core/coretypes.py @@ -40,7 +40,8 @@ class APINode: HTTP_EMOJI = { - 200: "🆗", - 404: "🔍", - 500: "☠️", -} \ No newline at end of file + 2: "✅", + 3: "➡️", + 4: "🔍", + 5: "❌️", +} diff --git a/apps/core/pyproject.toml b/apps/core/pyproject.toml index 6bc5c62..cebfd35 100644 --- a/apps/core/pyproject.toml +++ b/apps/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "core" -version = "0.4.0" +version = "0.5.0" description = "Types and other core functionality" authors = ["kiriharu "] diff --git a/apps/tgbot/tgbot/handlers/default/web.py b/apps/tgbot/tgbot/handlers/default/web.py index c9f4989..70910f1 100644 --- a/apps/tgbot/tgbot/handlers/default/web.py +++ b/apps/tgbot/tgbot/handlers/default/web.py @@ -23,8 +23,8 @@ async def prepare_webcheck_message(response: Response) -> str: status = json_rsp.get("status") if status == ResponseStatus.OK: status_code = json_rsp['payload']['status_code'] - time = round(json_rsp['payload']['time'], 3) - message = f"Location, Town: {HTTP_EMOJI.get(status_code, None)} {status_code}, {time} сек." + time = round(json_rsp['payload']['time'], 2) + message = f"Location, Town: {HTTP_EMOJI.get(status_code//100, '')} {status_code}, ⏰ {time} сек." if status == ResponseStatus.ERROR: message = json_rsp['payload']['message'] message = f"Location, Town: ❌ {message}" @@ -48,7 +48,8 @@ async def check_web(message: Message, host: str, port: Optional[int]): if port is None: port = 80 rsp_msg = await message.answer(f"Отчет о проверке хоста {host}:{port}...\n\n") - iter_keys = 1 + iter_keys = 1 # because I can't use enumerate + # using generators for magic... async for res in send_check_requests(host, port): # set typing status... await message.bot.send_chat_action(message.chat.id, 'typing')