From 308d6e85a2c7ceec261220a4343314cf8faff020 Mon Sep 17 00:00:00 2001 From: shuiping233 <1944680304@qq.com> Date: Tue, 17 Mar 2026 19:17:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=20kook=5Ftype=20=E4=B8=AD?= =?UTF-8?q?=E7=9A=84StrEnum=E7=B1=BB=E9=99=8D=E7=BA=A7=E4=B8=BA=E6=97=A7?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=9E=9A=E4=B8=BE=E5=86=99=E6=B3=95?= =?UTF-8?q?`(str,=20Enum)`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我那时候搓 #5719 的时候 #5729 已经合并了, 既然ruff的py限制版本里是`3.12`,那我那时候干脆用的StrEnum,现在发现那个pr revert了,那我也降级回旧Enum写法好了 --- astrbot/core/platform/sources/kook/kook_types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/astrbot/core/platform/sources/kook/kook_types.py b/astrbot/core/platform/sources/kook/kook_types.py index 7256fbbd4a..5efaf2a14c 100644 --- a/astrbot/core/platform/sources/kook/kook_types.py +++ b/astrbot/core/platform/sources/kook/kook_types.py @@ -1,5 +1,5 @@ import json -from enum import IntEnum, StrEnum +from enum import Enum, IntEnum from typing import Annotated, Any, Literal from pydantic import BaseModel, ConfigDict, Field, model_validator @@ -36,7 +36,7 @@ class KookMessageType(IntEnum): SYSTEM = 255 -class KookModuleType(StrEnum): +class KookModuleType(str, Enum): PLAIN_TEXT = "plain-text" KMARKDOWN = "kmarkdown" IMAGE = "image" @@ -311,7 +311,7 @@ class KookMessageSignal(IntEnum): """server->client resume ack""" -class KookChannelType(StrEnum): +class KookChannelType(str, Enum): GROUP = "GROUP" PERSON = "PERSON" BROADCAST = "BROADCAST"