refactor(models/events): 为所有事件类添加kw_only参数

统一为所有dataclass装饰的事件类添加kw_only=True参数,确保实例化时必须使用关键字参数
This commit is contained in:
2026-03-21 13:59:03 +08:00
parent f753f4de87
commit 00031fc7a1
5 changed files with 23 additions and 23 deletions

View File

@@ -34,7 +34,7 @@ MESSAGE_EVENT_OP = Permission.OP
MESSAGE_EVENT_USER = Permission.USER
@dataclass(slots=True)
@dataclass(slots=True, kw_only=True)
class MessageEvent(OneBotEvent):
"""
消息事件基类
@@ -87,7 +87,7 @@ class MessageEvent(OneBotEvent):
raise NotImplementedError("reply method must be implemented by subclasses")
@dataclass(slots=True)
@dataclass(slots=True, kw_only=True)
class PrivateMessageEvent(MessageEvent):
"""
私聊消息事件
@@ -105,7 +105,7 @@ class PrivateMessageEvent(MessageEvent):
)
@dataclass(slots=True)
@dataclass(slots=True, kw_only=True)
class GroupMessageEvent(MessageEvent):
"""
群聊消息事件