修复:group_horse_racing 权限检查问题1
- 添加 field_validator 来正确解析环境变量中的 ID 集合 - 支持 JSON 格式 "[1424473282]" 和逗号分隔格式 "1424473282,621016172" - 修复 TESTERS、TEST_GROUPS、ALLOWED_GROUPS 的环境变量解析 - 移除调试日志,保持代码整洁 这解决了环境变量中的 JSON 字符串无法正确解析为集合的问题。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
25
test_config_debug.py
Normal file
25
test_config_debug.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Print environment variables
|
||||
print("=== Environment Variables ===")
|
||||
for key in os.environ:
|
||||
if "GROUP_HORSE_RACING" in key:
|
||||
print(f"{key}={os.environ[key]}")
|
||||
|
||||
print("\n=== Loading Config ===")
|
||||
from danding_bot.plugins.group_horse_racing.config import Config
|
||||
|
||||
config = Config()
|
||||
print(f"TEST_MODE: {config.TEST_MODE} (type: {type(config.TEST_MODE).__name__})")
|
||||
print(f"TESTERS: {config.TESTERS} (type: {type(config.TESTERS).__name__})")
|
||||
print(f"TEST_GROUPS: {config.TEST_GROUPS} (type: {type(config.TEST_GROUPS).__name__})")
|
||||
print(f"ALLOWED_GROUPS: {config.ALLOWED_GROUPS} (type: {type(config.ALLOWED_GROUPS).__name__})")
|
||||
|
||||
print("\n=== Testing Permission Check ===")
|
||||
test_user_id = 1424473282
|
||||
print(f"Test user_id: {test_user_id}")
|
||||
print(f"Is in TESTERS: {test_user_id in config.TESTERS}")
|
||||
print(f"TEST_MODE enabled: {config.TEST_MODE}")
|
||||
print(f"Should have access: {config.TEST_MODE and test_user_id in config.TESTERS}")
|
||||
Reference in New Issue
Block a user