From feb39b11d5e82410f5b708bb718ac49ec0fa3ecd Mon Sep 17 00:00:00 2001 From: snowy-yang <102860110+snowy-yang@users.noreply.github.com> Date: Thu, 24 Sep 2026 22:40:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E5=8E=BB=20intents=20?= =?UTF-8?q?=E7=BB=84=E5=86=85=E4=BA=8B=E4=BB=B6=E5=BC=80=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E4=B8=93=E5=B1=9E=E6=A0=A1=E9=AA=8C=EF=BC=88dict=20=E6=9C=AC?= =?UTF-8?q?=E5=B0=B1=E8=A2=AB=E5=B8=83=E5=B0=94=E6=A0=A1=E9=AA=8C=E6=8B=A6?= =?UTF-8?q?=E4=B8=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/qqbotsdk/ws_protocol.py | 4 ---- tests/test_intents.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qqbotsdk/ws_protocol.py b/src/qqbotsdk/ws_protocol.py index 7446381..c5103b1 100644 --- a/src/qqbotsdk/ws_protocol.py +++ b/src/qqbotsdk/ws_protocol.py @@ -41,10 +41,6 @@ def get_intents(path: str) -> int: intent = INTENT_GROUPS.get(group) if intent is None: raise ValueError(f"未知的 intents 分组: {group}") - if isinstance(enabled, dict): - raise ValueError( - f"intents 分组 {group} 不支持组内事件开关,请改为 {group} = true/false" - ) if not isinstance(enabled, bool): raise ValueError( f"intents 分组 {group} 的值应为 true/false,实际为 {enabled!r}" diff --git a/tests/test_intents.py b/tests/test_intents.py index fe167da..5ea5b87 100644 --- a/tests/test_intents.py +++ b/tests/test_intents.py @@ -51,7 +51,7 @@ def test_non_bool_value_raises(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") - with pytest.raises(ValueError, match="组内事件开关"): + with pytest.raises(ValueError, match="true/false"): get_intents(path)