From 6ef3b09ec904eec60327325c1d0cfebd1482f299 Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 21 Jul 2024 16:06:50 +0800 Subject: [PATCH] =?UTF-8?q?:memo:=20=E6=81=A2=E5=A4=8Dpyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - pyproject.toml | 38 +++++++++++++++ requirements.txt | 1 + .../__init__.py | 41 ++++++++-------- src/plugins/packmanv2/handle.py | 0 src/plugins/packmanv2/npm/__init__.py | 0 src/plugins/packmanv2/npm/data_source.py | 6 +++ src/plugins/packmanv2/rpm/__init__.py | 0 .../{liteyuki_webdash => webdash}/__init__.py | 42 ++++++++-------- .../{liteyuki_webdash => webdash}/common.py | 6 +-- .../{liteyuki_webdash => webdash}/main.py | 20 ++++---- .../restful_api.py | 48 +++++++++---------- 12 files changed, 124 insertions(+), 79 deletions(-) create mode 100644 pyproject.toml rename src/plugins/{liteyuki_packmanv2 => packmanv2}/__init__.py (70%) create mode 100644 src/plugins/packmanv2/handle.py create mode 100644 src/plugins/packmanv2/npm/__init__.py create mode 100644 src/plugins/packmanv2/npm/data_source.py create mode 100644 src/plugins/packmanv2/rpm/__init__.py rename src/plugins/{liteyuki_webdash => webdash}/__init__.py (97%) rename src/plugins/{liteyuki_webdash => webdash}/common.py (96%) rename src/plugins/{liteyuki_webdash => webdash}/main.py (94%) rename src/plugins/{liteyuki_webdash => webdash}/restful_api.py (95%) diff --git a/.gitignore b/.gitignore index 2742fc11..cb3dd7ab 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ compile.bat src/resources/templates/latest-debug.html # vuepress .github -pyproject.toml test.py line_count.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9d99770f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[tool.nonebot] +[project] +# PEP 621 project metadata +# See https://www.python.org/dev/peps/pep-0621/ +authors = [ + {name = "SnowyKami", email = "snowykami@outlook.com"}, +] +license = {text = "MIT & LSO"} +requires-python = ">=3.10,<4.0" +dependencies = [ + +] + +dynamic = ["version"] +name = "liteyuki-bot" +description = "Push dynamics and live informations from bilibili to QQ. Based on nonebot2." +readme = "README.md" +keywords = ["nonebot", "nonebot2", "qqbot", "liteyuki", "bot"] + +[project.urls] +homepage = "https://bot.liteyuki.icu" +repository = "https://github.com/LiteyukiStudio/LiteyukiBot" +documentation = "https://bot.liteyuki.icu" + +[tool.pdm.dev-dependencies] +dev = [] + +[tool.nonebot] +adapters = [ + { name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" } + +] +plugins = ["haruka_bot", "nonebot_plugin_gocqhttp", "nonebot_plugin_guild_patch"] +plugin_dirs = [] +builtin_plugins = [] + +[project.scripts] +ly = "main.py" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index dc47244f..4b9766d0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,5 +26,6 @@ watchdog~=4.0.0 pillow~=10.2.0 jieba~=0.42.1 pip~=23.2.1 +aiosqlite3~=0.3.0 fastapi~=0.110.0 python-dotenv~=1.0.1 \ No newline at end of file diff --git a/src/plugins/liteyuki_packmanv2/__init__.py b/src/plugins/packmanv2/__init__.py similarity index 70% rename from src/plugins/liteyuki_packmanv2/__init__.py rename to src/plugins/packmanv2/__init__.py index d5bbbc0d..92c34d92 100644 --- a/src/plugins/liteyuki_packmanv2/__init__.py +++ b/src/plugins/packmanv2/__init__.py @@ -1,20 +1,21 @@ -from nonebot.plugin import PluginMetadata - -__author__ = "snowykami" -__plugin_meta__ = PluginMetadata( - name="轻雪包管理器v2", - description="详细看文档", - usage=( - "npm list\n" - "npm enable/disable \n" - "npm search \n" - "npm install/uninstall \n" - ), - type="application", - homepage="https://github.com/snowykami/LiteyukiBot", - extra={ - "liteyuki": True, - "toggleable" : False, - "default_enable" : False, - } -) +from nonebot.plugin import PluginMetadata + +__author__ = "snowykami" +__plugin_meta__ = PluginMetadata( + name="轻雪包管理器v2", + description="npm & rpm", + usage=( + "npm list\n" + "npm enable/disable \n" + "npm search \n" + "npm install/uninstall \n" + ), + type="application", + homepage="https://github.com/snowykami/LiteyukiBot", + extra={ + "liteyuki" : True, + "toggleable" : False, + "always_on" : True, + "default_enable": False, + } +) diff --git a/src/plugins/packmanv2/handle.py b/src/plugins/packmanv2/handle.py new file mode 100644 index 00000000..e69de29b diff --git a/src/plugins/packmanv2/npm/__init__.py b/src/plugins/packmanv2/npm/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/plugins/packmanv2/npm/data_source.py b/src/plugins/packmanv2/npm/data_source.py new file mode 100644 index 00000000..94ab782b --- /dev/null +++ b/src/plugins/packmanv2/npm/data_source.py @@ -0,0 +1,6 @@ +class Session: + def __init__(self, session_type: str, session_id: int | str): + self.session_type = session_type + self.session_id = session_id + + diff --git a/src/plugins/packmanv2/rpm/__init__.py b/src/plugins/packmanv2/rpm/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/plugins/liteyuki_webdash/__init__.py b/src/plugins/webdash/__init__.py similarity index 97% rename from src/plugins/liteyuki_webdash/__init__.py rename to src/plugins/webdash/__init__.py index 6f46e9a9..faab14b7 100644 --- a/src/plugins/liteyuki_webdash/__init__.py +++ b/src/plugins/webdash/__init__.py @@ -1,21 +1,21 @@ -from nonebot.plugin import PluginMetadata - -from .main import * - -__author__ = "snowykami" -__plugin_meta__ = PluginMetadata( - name="网页监控面板", - description="网页监控面板,用于查看机器人的状态和信息", - usage=( - "访问 127.0.0.1:port 查看机器人的状态信息\n" - "stat msg -g|--group [group_id] 查看群的统计信息,不带参数为全群\n" - "配置项:custom_domain,自定义域名,通常对外用,内网无需" - ), - type="application", - homepage="https://github.com/snowykami/LiteyukiBot", - extra={ - "liteyuki" : True, - "toggleable" : False, - "default_enable": True, - } -) +from nonebot.plugin import PluginMetadata + +from .main import * + +__author__ = "snowykami" +__plugin_meta__ = PluginMetadata( + name="网页监控面板", + description="网页监控面板,用于查看机器人的状态和信息", + usage=( + "访问 127.0.0.1:port 查看机器人的状态信息\n" + "stat msg -g|--group [group_id] 查看群的统计信息,不带参数为全群\n" + "配置项:custom_domain,自定义域名,通常对外用,内网无需" + ), + type="application", + homepage="https://github.com/snowykami/LiteyukiBot", + extra={ + "liteyuki" : True, + "toggleable" : False, + "default_enable": True, + } +) diff --git a/src/plugins/liteyuki_webdash/common.py b/src/plugins/webdash/common.py similarity index 96% rename from src/plugins/liteyuki_webdash/common.py rename to src/plugins/webdash/common.py index 29b4ebfa..b9abd373 100644 --- a/src/plugins/liteyuki_webdash/common.py +++ b/src/plugins/webdash/common.py @@ -1,4 +1,4 @@ -from fastapi import FastAPI -from nonebot import get_app - +from fastapi import FastAPI +from nonebot import get_app + app: FastAPI = get_app() \ No newline at end of file diff --git a/src/plugins/liteyuki_webdash/main.py b/src/plugins/webdash/main.py similarity index 94% rename from src/plugins/liteyuki_webdash/main.py rename to src/plugins/webdash/main.py index 3be44c24..40506b19 100644 --- a/src/plugins/liteyuki_webdash/main.py +++ b/src/plugins/webdash/main.py @@ -1,10 +1,10 @@ -from fastapi import FastAPI -from nonebot import get_app -from .restful_api import * - - -@app.get("/ping") -async def root(): - return { - "message": "pong" - } +from fastapi import FastAPI +from nonebot import get_app +from .restful_api import * + + +@app.get("/ping") +async def root(): + return { + "message": "pong" + } diff --git a/src/plugins/liteyuki_webdash/restful_api.py b/src/plugins/webdash/restful_api.py similarity index 95% rename from src/plugins/liteyuki_webdash/restful_api.py rename to src/plugins/webdash/restful_api.py index 3235b383..873cb691 100644 --- a/src/plugins/liteyuki_webdash/restful_api.py +++ b/src/plugins/webdash/restful_api.py @@ -1,24 +1,24 @@ -from fastapi import FastAPI, APIRouter -from .common import * - -device_info_router = APIRouter(prefix="/api/device-info") -bot_info_router = APIRouter(prefix="/api/bot-info") - - -@device_info_router.get("/") -async def device_info(): - print("Hello Device Info") - return { - "message": "Hello Device Info" - } - - -@bot_info_router.get("/") -async def bot_info(): - return { - "message": "Hello Bot Info" - } - - -app.include_router(device_info_router) -app.include_router(bot_info_router) +from fastapi import FastAPI, APIRouter +from .common import * + +device_info_router = APIRouter(prefix="/api/device-info") +bot_info_router = APIRouter(prefix="/api/bot-info") + + +@device_info_router.get("/") +async def device_info(): + print("Hello Device Info") + return { + "message": "Hello Device Info" + } + + +@bot_info_router.get("/") +async def bot_info(): + return { + "message": "Hello Bot Info" + } + + +app.include_router(device_info_router) +app.include_router(bot_info_router)