refactor(bf-bot): 插件重构为 handlers/services/utils 分层,资源归入 res/

- 旧平铺模块(data/data_utils/database_op/image_builder*/get_bf6_data/
  gametools_bf6/bf6_data/img_utils)拆分为 handlers(绑定/查询)、
  services(fetchers/processing/query)、utils(渲染/参数)分层;
  新增 repository.py / config.py / paths.py
- 字体/图片/模板资源迁入 res/,新增 BF2042 卡面素材(bg/object_icon 等)
- browser_ext/:BF2042 扩展捕获桥(WS 直连兜底通道)源码入库
- 新增 hexi/web/src/plugins/bf_bot 前端管理页
- 新增 tests:test_bf_bot_helpers / repository / tracker_api

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
sansenhoshiandClaude Code committed 2026-10-13 17:53:06 +08:00
1 parent 614e1d7e00
commit a31aab00e8
752 files changed
+6241 -2506

No files matched your search

@@ -0,0 +1,39 @@
"""绑定管理命令:/bfbind(绑定) /unbind(解绑) /update_bind(修改绑定)。"""
from nonebot import on_command
from nonebot.adapters import Event, Message
from nonebot.params import CommandArg
from nonebot.rule import to_me
from nonebot_plugin_alconna import UniMessage
from ..services import binding as binding_service
bind_cmd = on_command("bfbind", rule=to_me(), aliases={"绑定"}, block=True)
unbind_cmd = on_command("unbind", rule=to_me(), aliases={"解绑"}, block=True)
update_bind_cmd = on_command(
"update_bind", rule=to_me(), aliases={"修改绑定"}, block=True
)
async def _reply(event: Event, text: str) -> None:
await UniMessage.at(user_id=event.get_user_id()).text(text).send()
@bind_cmd.handle()
async def handle_bind(event: Event, msg: Message = CommandArg()):
text = await binding_service.bind(event.get_user_id(), msg.extract_plain_text())
await _reply(event, text)
@unbind_cmd.handle()
async def handle_unbind(event: Event):
text = await binding_service.unbind(event.get_user_id())
await _reply(event, text)
@update_bind_cmd.handle()
async def handle_update_bind(event: Event, msg: Message = CommandArg()):
text = await binding_service.update_bind(
event.get_user_id(), msg.extract_plain_text()
)
await _reply(event, text)