From 55ae431d102a8ac371c86bf15c5368c864f20a79 Mon Sep 17 00:00:00 2001 From: zhilv Date: Fri, 1 May 2026 22:06:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(*):=20=E5=B0=86=E6=96=87=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=BB=8E=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84=E7=BB=99?= =?UTF-8?q?=E4=B8=BA=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 0 handlers/health.py | 2 +- handlers/message.py | 4 ++-- handlers/upload.py | 4 ++-- middleware.py | 4 ++-- plugin.py | 10 +++++----- 6 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 __init__.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/handlers/health.py b/handlers/health.py index 8d63173..404e1f3 100644 --- a/handlers/health.py +++ b/handlers/health.py @@ -2,7 +2,7 @@ from aiohttp import web -from response import ok +from ..response import ok async def health_handler(request: web.Request) -> web.Response: diff --git a/handlers/message.py b/handlers/message.py index e84423a..6fc19f5 100644 --- a/handlers/message.py +++ b/handlers/message.py @@ -4,8 +4,8 @@ import asyncio from aiohttp import web -from config import QQ_API_MAX_RETRIES, QQ_API_TIMEOUT -from response import error, ok +from ..config import QQ_API_MAX_RETRIES, QQ_API_TIMEOUT +from ..response import error, ok VALID_MSG_TYPES = {"text", "image", "file", "video"} diff --git a/handlers/upload.py b/handlers/upload.py index 4a7c2c9..282aa48 100644 --- a/handlers/upload.py +++ b/handlers/upload.py @@ -7,8 +7,8 @@ from pathlib import Path from aiohttp import BodyPartReader, web -from config import ALLOWED_EXTENSIONS, MAX_UPLOAD_SIZE, UPLOAD_DIR -from response import error, ok +from ..config import ALLOWED_EXTENSIONS, MAX_UPLOAD_SIZE, UPLOAD_DIR +from ..response import error, ok logger = logging.getLogger("webhook-plugin.upload") diff --git a/middleware.py b/middleware.py index 0a0c149..dba4e91 100644 --- a/middleware.py +++ b/middleware.py @@ -4,8 +4,8 @@ import uuid from aiohttp import web -from config import WEBHOOK_API_KEY -from response import error +from .config import WEBHOOK_API_KEY +from .response import error @web.middleware diff --git a/plugin.py b/plugin.py index d0eb8f4..ea8a0f1 100644 --- a/plugin.py +++ b/plugin.py @@ -6,11 +6,11 @@ import logging from aiohttp import web from ncatbot.plugin import NcatBotPlugin -from config import HOST, PORT, UPLOAD_DIR, WEBHOOK_API_KEY -from handlers.health import health_handler -from handlers.message import webhook_handler -from handlers.upload import cleanup_expired_files, upload_handler -from middleware import auth_middleware, request_id_middleware +from .config import HOST, PORT, UPLOAD_DIR, WEBHOOK_API_KEY +from .handlers.health import health_handler +from .handlers.message import webhook_handler +from .handlers.upload import cleanup_expired_files, upload_handler +from .middleware import auth_middleware, request_id_middleware logging.basicConfig( level=logging.INFO,