mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-22 05:46:33 +03:00
this should probably make relative imports work
This commit is contained in:
parent
eda75f552c
commit
723172387b
|
@ -8,6 +8,6 @@ RUN apk update \
|
||||||
&& apk add gcc python3-dev musl-dev libffi-dev openssl-dev make cargo
|
&& apk add gcc python3-dev musl-dev libffi-dev openssl-dev make cargo
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR tgbot/tgbot
|
WORKDIR tgbot
|
||||||
RUN pip install --upgrade pip; pip install poetry; poetry config virtualenvs.create false; poetry install
|
RUN pip install --upgrade pip; pip install poetry; poetry config virtualenvs.create false; poetry install
|
||||||
CMD poetry shell; python bot.py
|
CMD poetry shell; python bot.py
|
||||||
|
|
|
@ -5,8 +5,8 @@ from tortoise import Tortoise
|
||||||
from tortoise.exceptions import DBConnectionError
|
from tortoise.exceptions import DBConnectionError
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from asyncio import sleep
|
from asyncio import sleep
|
||||||
import config
|
import tgbot.config as config
|
||||||
import handlers
|
import tgbot.handlers as handlers
|
||||||
|
|
||||||
storage = MemoryStorage()
|
storage = MemoryStorage()
|
||||||
telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN)
|
telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN)
|
1
apps/tgbot/test/__init__.py
Normal file
1
apps/tgbot/test/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from ..handlers.default.tcp import TCPCheckerHandler
|
from tgbot.handlers.default.tcp import TCPCheckerHandler
|
||||||
from ..handlers.base import process_args_for_host_port,\
|
from tgbot.handlers.base import process_args_for_host_port,\
|
||||||
NotEnoughArgs, InvalidPort
|
NotEnoughArgs, InvalidPort
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from aiogram.types import Message
|
from aiogram.types import Message
|
||||||
from typing import Tuple, Any, List
|
from typing import Tuple, Any, List
|
||||||
|
|
||||||
from tgbot.nodes import nodes as all_nodes
|
from ..nodes import nodes as all_nodes
|
||||||
from httpx import Response
|
from httpx import Response
|
||||||
from aiogram.bot import Bot
|
from aiogram.bot import Bot
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -9,7 +9,7 @@ from core.coretypes import APINodeInfo
|
||||||
from .helpers import send_api_requests
|
from .helpers import send_api_requests
|
||||||
from .errors import NotEnoughArgs, InvalidPort, LocalhostForbidden
|
from .errors import NotEnoughArgs, InvalidPort, LocalhostForbidden
|
||||||
from .validators import BaseValidator, LocalhostValidator
|
from .validators import BaseValidator, LocalhostValidator
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ..middlewares.throttling import rate_limit
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from time import time
|
from time import time
|
||||||
|
|
|
@ -3,7 +3,7 @@ from httpx import Response
|
||||||
from core.coretypes import ErrorPayload, ICMPCheckerResponse, ResponseStatus
|
from core.coretypes import ErrorPayload, ICMPCheckerResponse, ResponseStatus
|
||||||
from ..base import CheckerBaseHandler, NotEnoughArgs, LocalhostForbidden
|
from ..base import CheckerBaseHandler, NotEnoughArgs, LocalhostForbidden
|
||||||
from ..metrics import push_status_metric
|
from ..metrics import push_status_metric
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ...middlewares.throttling import rate_limit
|
||||||
|
|
||||||
icmp_help_message = """
|
icmp_help_message = """
|
||||||
❓ Производит проверку хоста по протоколу ICMP.
|
❓ Производит проверку хоста по протоколу ICMP.
|
||||||
|
|
|
@ -2,8 +2,8 @@ from aiogram.types import Message
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
|
||||||
from tgbot.handlers.base import SimpleCommandHandler, NotEnoughArgs
|
from ..base import SimpleCommandHandler, NotEnoughArgs
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ...middlewares.throttling import rate_limit
|
||||||
|
|
||||||
ipcalc_help_message = """
|
ipcalc_help_message = """
|
||||||
❓ Калькулятор IP подсетей.
|
❓ Калькулятор IP подсетей.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from core.coretypes import ResponseStatus, ErrorPayload, MinecraftResponse
|
from core.coretypes import ResponseStatus, ErrorPayload, MinecraftResponse
|
||||||
from httpx import Response
|
from httpx import Response
|
||||||
|
|
||||||
from tgbot.handlers.base import CheckerTargetPortHandler, process_args_for_host_port
|
from ..base import CheckerTargetPortHandler, process_args_for_host_port
|
||||||
from tgbot.handlers.metrics import push_status_metric
|
from ..metrics import push_status_metric
|
||||||
|
|
||||||
minecraft_help_message = """
|
minecraft_help_message = """
|
||||||
❓ Получает статистику о Minecraft сервере
|
❓ Получает статистику о Minecraft сервере
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from aiogram.types import Message
|
from aiogram.types import Message
|
||||||
from tgbot.models.user import User
|
from ...models.user import User
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ...middlewares.throttling import rate_limit
|
||||||
from tgbot.middlewares.userdata import userdata_required
|
from ...middlewares.userdata import userdata_required
|
||||||
|
|
||||||
start_message = """
|
start_message = """
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ from aiogram.types import Message
|
||||||
from core.coretypes import ResponseStatus, ErrorPayload, PortResponse
|
from core.coretypes import ResponseStatus, ErrorPayload, PortResponse
|
||||||
from httpx import Response
|
from httpx import Response
|
||||||
|
|
||||||
from tgbot.handlers.base import CheckerTargetPortHandler, NotEnoughArgs, InvalidPort, parse_host_port
|
from ..base import CheckerTargetPortHandler, NotEnoughArgs, InvalidPort, parse_host_port
|
||||||
from tgbot.handlers.metrics import push_status_metric
|
from ..metrics import push_status_metric
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ...middlewares.throttling import rate_limit
|
||||||
|
|
||||||
tcp_help_message = """
|
tcp_help_message = """
|
||||||
❓ Производит проверку TCP порта, открыт ли он или нет
|
❓ Производит проверку TCP порта, открыт ли он или нет
|
||||||
|
|
|
@ -6,10 +6,10 @@ from dataclasses import dataclass
|
||||||
from whois_vu.api import WhoisSource
|
from whois_vu.api import WhoisSource
|
||||||
from whois_vu.errors import IncorrectZone, QueryNotMatchRegexp
|
from whois_vu.errors import IncorrectZone, QueryNotMatchRegexp
|
||||||
|
|
||||||
from tgbot.handlers.whois_zones import ZONES
|
from ..whois_zones import ZONES
|
||||||
from tgbot.handlers.base import SimpleCommandHandler
|
from ..base import SimpleCommandHandler
|
||||||
from tgbot.handlers.errors import NotEnoughArgs, LocalhostForbidden
|
from ..errors import NotEnoughArgs, LocalhostForbidden
|
||||||
from tgbot.middlewares.throttling import rate_limit
|
from ...middlewares.throttling import rate_limit
|
||||||
|
|
||||||
whois_help_message = """
|
whois_help_message = """
|
||||||
❓ Вернёт информацию о домене.
|
❓ Вернёт информацию о домене.
|
||||||
|
|
|
@ -5,8 +5,8 @@ from ipaddress import ip_address
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from aiogram.bot import Bot
|
from aiogram.bot import Bot
|
||||||
from tgbot.handlers.metrics import push_api_request_status
|
from .metrics import push_api_request_status
|
||||||
from tgbot.config import NOTIFICATION_BOT_TOKEN, NOTIFICATION_USERS
|
from ..config import NOTIFICATION_BOT_TOKEN, NOTIFICATION_USERS
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from aioinflux import InfluxDBClient
|
from aioinflux import InfluxDBClient
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from tgbot.config import INFLUX_DB, INFLUX_HOST, INFLUX_PORT, INFLUX_PASSWORD, INFLUX_USERNAME
|
from ..config import INFLUX_DB, INFLUX_HOST, INFLUX_PORT, INFLUX_PASSWORD, INFLUX_USERNAME
|
||||||
|
|
||||||
|
|
||||||
async def push_metric(measurement, tags: Dict, fields: Dict):
|
async def push_metric(measurement, tags: Dict, fields: Dict):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from tgbot.middlewares.write_command_metric import WriteCommandMetric
|
from .write_command_metric import WriteCommandMetric
|
||||||
from tgbot.middlewares.logging import LoggingMiddleware
|
from .logging import LoggingMiddleware
|
||||||
from tgbot.middlewares.throttling import ThrottlingMiddleware
|
from .throttling import ThrottlingMiddleware
|
||||||
from tgbot.middlewares.userdata import UserMiddleware
|
from .userdata import UserMiddleware
|
||||||
|
|
|
@ -2,7 +2,7 @@ from aiogram.dispatcher.handler import current_handler
|
||||||
from aiogram.dispatcher.middlewares import BaseMiddleware
|
from aiogram.dispatcher.middlewares import BaseMiddleware
|
||||||
from aiogram.types import Message, CallbackQuery
|
from aiogram.types import Message, CallbackQuery
|
||||||
|
|
||||||
from tgbot.models import User
|
from ..models import User
|
||||||
|
|
||||||
|
|
||||||
def userdata_required(func):
|
def userdata_required(func):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from aiogram.dispatcher.middlewares import BaseMiddleware
|
from aiogram.dispatcher.middlewares import BaseMiddleware
|
||||||
from aiogram.types import Message
|
from aiogram.types import Message
|
||||||
from tgbot.handlers.metrics import push_metric
|
from ..handlers.metrics import push_metric
|
||||||
from tgbot.models import User, UserCheckRequests
|
from ..models import User, UserCheckRequests
|
||||||
|
|
||||||
|
|
||||||
class WriteCommandMetric(BaseMiddleware):
|
class WriteCommandMetric(BaseMiddleware):
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
from .test_port_parsers import *
|
|
Loading…
Reference in New Issue
Block a user