修复:group_horse_racing 配置键大小写匹配问题
NoneBot 将 .env 键名转为小写,前缀匹配需使用小写 group_horse_racing_ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,19 +19,10 @@ __plugin_meta__ = PluginMetadata(
|
||||
# 从 NoneBot driver config 中提取本插件配置(去掉 GROUP_HORSE_RACING_ 前缀)
|
||||
_nb_config = get_driver().config
|
||||
_raw = _nb_config.model_dump() if hasattr(_nb_config, "model_dump") else _nb_config.dict()
|
||||
_prefix = "GROUP_HORSE_RACING_"
|
||||
|
||||
print("[group_horse_racing] Raw NoneBot config keys (all):")
|
||||
for k, v in _raw.items():
|
||||
print(f" {k} = {v!r}")
|
||||
|
||||
print("[group_horse_racing] Filtered plugin config:")
|
||||
for k, v in _raw.items():
|
||||
if k.startswith(_prefix):
|
||||
print(f" {k} = {v!r}")
|
||||
_prefix = "group_horse_racing_"
|
||||
|
||||
plugin_config = Config(**{
|
||||
k[len(_prefix):]: v
|
||||
k[len(_prefix):].upper(): v
|
||||
for k, v in _raw.items()
|
||||
if k.startswith(_prefix)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user