Files
HeXi/dev/plugin_template/nonebot_plugin_template/__init__.py
T
sansenhoshi 131b92b319 结构调整
视频解析多图/多媒体结构 消息体适配
2026-09-08 14:25:32 +08:00

39 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""<插件名> — MTSS 结构 + 统一配置标准参考模板。
放在 hexi/plugins/ 后改名:目录 nonebot_plugin_<name>,并替换所有
`nonebot_plugin_template` / `template` 占位(建议全局搜索替换)。
结构:Trigger(handlers) → Service(services) → Model(repository/models)。
配置在 config.py 统一注册,Web 可读可改。
"""
from nonebot import require
from nonebot.plugin import PluginMetadata
require("nonebot_plugin_alconna")
__plugin_meta__ = PluginMetadata(
name="插件模板",
description="MTSS 结构 + 统一配置标准参考模板",
usage="模板指令 [参数]",
type="application",
)
# 入口只做四件事:require / meta / 导入子模块 / 配置注册
from . import config as _config # noqa: E402,F401
from . import handlers as _handlers # noqa: E402,F401
from . import web as _web # noqa: E402,F401
from hexi.web_hub.web_plugin_registry import register_web_plugin # noqa: E402
_config.register_config()
# 注册到统一 Web 管理台(/hub):hub 启动时自动挂载 /api/template
register_web_plugin(
"template",
"插件模板",
"user",
lambda: _web.build_admin_app(),
module_name=__name__,
)