refactor: restructure plugins per MTSS standard, consolidate assets to res/

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>
This commit is contained in:
2026-09-03 00:44:38 +08:00
co-authored by Claude
parent 25bc30611f
commit 9371a28e35
2389 changed files with 5100 additions and 10127 deletions
@@ -113,3 +113,47 @@ def log_debug(command: str, info: str):
def log_info(command: str, info: str):
logger.opt(colors=True).info(f"<u><y>[{command}]</y></u>{escape_tag(info)}")
def register_config() -> None:
"""把顶层 ChatConfig 顶层字段接入统一 Web 配置标准(/hub 可读可改)。
getter/setter 直接读写 config_manager.config,并保存到 learning_chat.yml。
权威源是插件自身的 yml,故 nosave 不写入 plugin_config.json(避免与自有后台互相覆盖)。
"""
from hexi.config_standard import register_config_items
def _get(key):
return getattr(config_manager.config, key)
def _set(key, value):
setattr(config_manager.config, key, value)
config_manager.save()
fields = [
{"key": "total_enable", "label": "群聊学习总开关", "type": "bool"},
{"key": "enable_web", "label": "启用后台管理", "type": "bool"},
{"key": "web_username", "label": "后台管理用户名", "type": "string"},
{"key": "web_password", "label": "后台管理密码", "type": "password", "secret": True},
{"key": "web_secret_key", "label": "后台签名密钥", "type": "password", "secret": True},
{"key": "ban_words", "label": "全局屏蔽词", "type": "text", "item_type": "str"},
{"key": "ban_users", "label": "全局屏蔽用户", "type": "text", "item_type": "int"},
{"key": "KEYWORDS_SIZE", "label": "单句关键词分词数量", "type": "int"},
{"key": "cross_group_threshold", "label": "跨群回复阈值", "type": "int"},
{"key": "learn_max_count", "label": "最高学习次数", "type": "int"},
{"key": "dictionary", "label": "自定义词典", "type": "text", "item_type": "str"},
]
items = []
for f in fields:
items.append(
{
**f,
"getter": lambda key=f["key"]: _get(key),
"setter": lambda value, key=f["key"]: _set(key, value),
}
)
register_config_items(
__package__,
items,
apply_extra=lambda _values, _store: config_manager.save(),
)