mirror of
https://github.com/snowy-yang/qqbotsdk.git
synced 2026-10-21 12:18:20 +00:00
refactor: 删去 intents 组内事件开关的专属校验(dict 本就被布尔校验拦下)
This commit is contained in:
1 parent
e66148a75c
commit
feb39b11d5
2 files changed
+1
-5
No files matched your search
@@ -41,10 +41,6 @@ def get_intents(path: str) -> int:
|
|||||||
intent = INTENT_GROUPS.get(group)
|
intent = INTENT_GROUPS.get(group)
|
||||||
if intent is None:
|
if intent is None:
|
||||||
raise ValueError(f"未知的 intents 分组: {group}")
|
raise ValueError(f"未知的 intents 分组: {group}")
|
||||||
if isinstance(enabled, dict):
|
|
||||||
raise ValueError(
|
|
||||||
f"intents 分组 {group} 不支持组内事件开关,请改为 {group} = true/false"
|
|
||||||
)
|
|
||||||
if not isinstance(enabled, bool):
|
if not isinstance(enabled, bool):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"intents 分组 {group} 的值应为 true/false,实际为 {enabled!r}"
|
f"intents 分组 {group} 的值应为 true/false,实际为 {enabled!r}"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def test_non_bool_value_raises(tmp_path):
|
|||||||
|
|
||||||
def test_legacy_per_event_switches_are_rejected(tmp_path):
|
def test_legacy_per_event_switches_are_rejected(tmp_path):
|
||||||
path = write(tmp_path, "[GROUP_AND_C2C_EVENT]\nC2C_MESSAGE_CREATE = true\n")
|
path = write(tmp_path, "[GROUP_AND_C2C_EVENT]\nC2C_MESSAGE_CREATE = true\n")
|
||||||
with pytest.raises(ValueError, match="组内事件开关"):
|
with pytest.raises(ValueError, match="true/false"):
|
||||||
get_intents(path)
|
get_intents(path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user