Per docs/plugin-audit-report.md (plugins normalized to Trigger(handlers) → Service(services) → Model(repository/models) + utils): - Split monolithic __init__.py into handlers/services/utils across dailywife, deer_pipe, dice, galgame_card, helldivers_tools, huoziyinshua, learning_chat, makeaquote, mc_server_status, ncm_saying, picfinder_take, picstatus, random_jm_code, regif, steam_info, video_analysis, group_tools - Move static assets under res/: deer_pipe font/img, makeaquote font, helldivers img/templates, huoziyinshua HuoZiYinShua - Add config.py + register_config_items to ncm_saying, random_jm_code, group_tools; learning_chat unified config bridge - Remove deprecated: voice_trans plugin, bf_bot/test.py, dead code in dailywife/deer_pipe, empty dirs, debug scripts under helldivers temp - Disable brash_general_supercredits_tools (stub comment only) - bot.py: optional stdout/stderr redirect to log file for Web log viewer, force ANSI colorize on non-TTY sinks - Move runtime data (jm_code.json) out of plugin dir into hexi/data - Docs: plugin-audit-report.md; README reflects removed plugins Co-Authored-By: Claude <noreply@anthropic.com>
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
"""随机 JM 码 —— 配置注册(按《插件配置文件标准》)。
|
|
|
|
把原本硬编码在 __init__.py 里的文案模板 / 屏蔽码 / 白名单群号
|
|
注册为 Web 可读可改的配置项(来源无关,store=本模块)。运行期插件读本模块常量,
|
|
Web 保存后经 apply 热更新本模块属性,重启也不丢。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys as _sys
|
|
|
|
from hexi.config_standard import register_config_items
|
|
|
|
# plugin_id = NoneBot 插件模块名
|
|
_PLUGIN_ID = __package__
|
|
|
|
# —— 可配置常量(来源为本模块) ——
|
|
TEXT_TEMPLATES = [
|
|
"给你{code},拿去吧",
|
|
"给你{code},记得谢谢我",
|
|
"给你{code},注意保养弹簧",
|
|
]
|
|
BLOCK_CODE = ["350235", "350234"]
|
|
WHITE_LIST = ["1019165018"]
|
|
|
|
|
|
def register_config() -> None:
|
|
register_config_items(
|
|
_PLUGIN_ID,
|
|
[
|
|
{
|
|
"key": "TEXT_TEMPLATES",
|
|
"label": "随机文案模板",
|
|
"type": "text",
|
|
"item_type": "str",
|
|
"default": TEXT_TEMPLATES,
|
|
},
|
|
{
|
|
"key": "BLOCK_CODE",
|
|
"label": "屏蔽码",
|
|
"type": "text",
|
|
"item_type": "str",
|
|
"default": BLOCK_CODE,
|
|
},
|
|
{
|
|
"key": "WHITE_LIST",
|
|
"label": "白名单群号",
|
|
"type": "text",
|
|
"item_type": "str",
|
|
"default": WHITE_LIST,
|
|
},
|
|
],
|
|
store=_sys.modules[__name__],
|
|
)
|