refactor(models/events): 为所有事件类添加kw_only参数
统一为所有dataclass装饰的事件类添加kw_only=True参数,确保实例化时必须使用关键字参数
This commit is contained in:
@@ -7,7 +7,7 @@ from dataclasses import dataclass, field
|
||||
from .base import OneBotEvent, EventType
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(kw_only=True)
|
||||
class NoticeEvent(OneBotEvent):
|
||||
"""
|
||||
通知事件基类
|
||||
@@ -21,7 +21,7 @@ class NoticeEvent(OneBotEvent):
|
||||
return EventType.NOTICE
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class FriendAddNoticeEvent(NoticeEvent):
|
||||
"""
|
||||
好友添加通知
|
||||
@@ -30,7 +30,7 @@ class FriendAddNoticeEvent(NoticeEvent):
|
||||
"""新好友 QQ 号"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class FriendRecallNoticeEvent(NoticeEvent):
|
||||
"""
|
||||
好友消息撤回通知
|
||||
@@ -42,7 +42,7 @@ class FriendRecallNoticeEvent(NoticeEvent):
|
||||
"""被撤回的消息 ID"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupNoticeEvent(NoticeEvent):
|
||||
"""
|
||||
群组通知事件基类
|
||||
@@ -54,7 +54,7 @@ class GroupNoticeEvent(NoticeEvent):
|
||||
"""用户 QQ 号"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupRecallNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群消息撤回通知
|
||||
@@ -66,7 +66,7 @@ class GroupRecallNoticeEvent(GroupNoticeEvent):
|
||||
"""被撤回的消息 ID"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupIncreaseNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群成员增加通知
|
||||
@@ -82,7 +82,7 @@ class GroupIncreaseNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupDecreaseNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群成员减少通知
|
||||
@@ -100,7 +100,7 @@ class GroupDecreaseNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupAdminNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群管理员变动通知
|
||||
@@ -113,7 +113,7 @@ class GroupAdminNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupBanNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群禁言通知
|
||||
@@ -150,7 +150,7 @@ class GroupUploadFile:
|
||||
"""文件总线 ID"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class GroupUploadNoticeEvent(GroupNoticeEvent):
|
||||
"""
|
||||
群文件上传通知
|
||||
@@ -159,7 +159,7 @@ class GroupUploadNoticeEvent(GroupNoticeEvent):
|
||||
"""文件信息"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class NotifyNoticeEvent(NoticeEvent):
|
||||
"""
|
||||
系统通知事件基类 (notify)
|
||||
@@ -175,7 +175,7 @@ class NotifyNoticeEvent(NoticeEvent):
|
||||
"""发送者 QQ 号"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class PokeNotifyEvent(NotifyNoticeEvent):
|
||||
"""
|
||||
戳一戳通知
|
||||
@@ -187,7 +187,7 @@ class PokeNotifyEvent(NotifyNoticeEvent):
|
||||
"""群号 (如果是群内戳一戳)"""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class LuckyKingNotifyEvent(NotifyNoticeEvent):
|
||||
"""
|
||||
群红包运气王通知
|
||||
|
||||
Reference in New Issue
Block a user