修复:group_horse_racing 环境变量加载问题

- 修改 __init__.py 在插件初始化时加载 Config
- 修改 commands.py 和 test_commands.py 从 __init__.py 导入 plugin_config
- 确保配置通过 NoneBot 的 driver 正确加载环境变量
- 这样可以正确解析 .env 中的 JSON 格式环境变量

这解决了权限检查中 TESTERS 集合为空的问题。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 22:50:20 +08:00
parent 8eca8fba49
commit 387dd3a0bb
3 changed files with 9 additions and 8 deletions

View File

@@ -1,13 +1,10 @@
from nonebot import on_command
from nonebot.adapters.onebot.v11 import Bot, Event, GroupMessageEvent, PrivateMessageEvent
from .config import Config
from .room_store import RoomStore
from .points_service import PointsService
# Import config from __init__ to ensure it's loaded through NoneBot driver
from . import plugin_config as config
from .commands import get_scope, check_access, room_store, points_service
config = Config()
async def check_tester(event: Event) -> bool:
"""Check if user is a tester."""