Daily build

This commit is contained in:
2026-01-02 14:22:35 +08:00
parent 87fcb78dba
commit 3f76e7d022
17 changed files with 1425 additions and 400 deletions

View File

@@ -13,7 +13,10 @@ from .notice import (
NoticeEvent, FriendAddNoticeEvent, FriendRecallNoticeEvent,
GroupRecallNoticeEvent, GroupIncreaseNoticeEvent,
GroupDecreaseNoticeEvent, GroupAdminNoticeEvent, GroupBanNoticeEvent,
GroupUploadNoticeEvent, GroupUploadFile
GroupUploadNoticeEvent, GroupUploadFile,
NotifyNoticeEvent, PokeNotifyEvent, LuckyKingNotifyEvent, HonorNotifyEvent,
GroupCardNoticeEvent, OfflineFileNoticeEvent, OfflineFile,
ClientStatusNoticeEvent, ClientStatus, EssenceNoticeEvent
)
from .request import RequestEvent, FriendRequestEvent, GroupRequestEvent
from .meta import MetaEvent, HeartbeatEvent, LifeCycleEvent, HeartbeatStatus
@@ -204,6 +207,85 @@ class EventFactory:
user_id=data.get("user_id", 0),
file=file
)
elif notice_type == "notify":
sub_type = data.get("sub_type", "")
if sub_type == "poke":
return PokeNotifyEvent(
**common_args,
notice_type=notice_type,
sub_type=sub_type,
user_id=data.get("user_id", 0),
target_id=data.get("target_id", 0),
group_id=data.get("group_id", 0)
)
elif sub_type == "lucky_king":
return LuckyKingNotifyEvent(
**common_args,
notice_type=notice_type,
sub_type=sub_type,
user_id=data.get("user_id", 0),
group_id=data.get("group_id", 0),
target_id=data.get("target_id", 0)
)
elif sub_type == "honor":
return HonorNotifyEvent(
**common_args,
notice_type=notice_type,
sub_type=sub_type,
user_id=data.get("user_id", 0),
group_id=data.get("group_id", 0),
honor_type=data.get("honor_type", "")
)
else:
return NotifyNoticeEvent(
**common_args,
notice_type=notice_type,
sub_type=sub_type,
user_id=data.get("user_id", 0)
)
elif notice_type == "group_card":
return GroupCardNoticeEvent(
**common_args,
notice_type=notice_type,
group_id=data.get("group_id", 0),
user_id=data.get("user_id", 0),
card_new=data.get("card_new", ""),
card_old=data.get("card_old", "")
)
elif notice_type == "offline_file":
file_data = data.get("file", {})
file = OfflineFile(
name=file_data.get("name", ""),
size=file_data.get("size", 0),
url=file_data.get("url", "")
)
return OfflineFileNoticeEvent(
**common_args,
notice_type=notice_type,
user_id=data.get("user_id", 0),
file=file
)
elif notice_type == "client_status":
client_data = data.get("client", {})
client = ClientStatus(
online=client_data.get("online", False),
status=client_data.get("status", "")
)
return ClientStatusNoticeEvent(
**common_args,
notice_type=notice_type,
client=client
)
elif notice_type == "essence":
return EssenceNoticeEvent(
**common_args,
notice_type=notice_type,
sub_type=data.get("sub_type", ""),
group_id=data.get("group_id", 0),
sender_id=data.get("sender_id", 0),
operator_id=data.get("operator_id", 0),
message_id=data.get("message_id", 0)
)
else:
# 未知通知类型,返回基础通知事件
return NoticeEvent(**common_args, notice_type=notice_type)

View File

@@ -157,3 +157,143 @@ class GroupUploadNoticeEvent(GroupNoticeEvent):
"""
file: GroupUploadFile = field(default_factory=GroupUploadFile)
"""文件信息"""
@dataclass
class NotifyNoticeEvent(NoticeEvent):
"""
系统通知事件基类 (notify)
"""
sub_type: str = ""
"""
子类型
poke: 戳一戳
lucky_king: 运气王
honor: 群荣誉变更
"""
user_id: int = 0
"""发送者 QQ 号"""
@dataclass
class PokeNotifyEvent(NotifyNoticeEvent):
"""
戳一戳通知
"""
target_id: int = 0
"""被戳者 QQ 号"""
group_id: int = 0
"""群号 (如果是群内戳一戳)"""
@dataclass
class LuckyKingNotifyEvent(NotifyNoticeEvent):
"""
群红包运气王通知
"""
group_id: int = 0
"""群号"""
target_id: int = 0
"""运气王 QQ 号"""
@dataclass
class HonorNotifyEvent(NotifyNoticeEvent):
"""
群荣誉变更通知
"""
group_id: int = 0
"""群号"""
honor_type: str = ""
"""
荣誉类型
talkative: 龙王
performer: 群聊之火
emotion: 快乐源泉
"""
@dataclass
class GroupCardNoticeEvent(GroupNoticeEvent):
"""
群成员名片更新通知
"""
card_new: str = ""
"""新名片"""
card_old: str = ""
"""旧名片"""
@dataclass
class OfflineFile:
"""
离线文件信息
"""
name: str = ""
"""文件名"""
size: int = 0
"""文件大小"""
url: str = ""
"""下载链接"""
@dataclass
class OfflineFileNoticeEvent(NoticeEvent):
"""
接收离线文件通知
"""
user_id: int = 0
"""发送者 QQ 号"""
file: OfflineFile = field(default_factory=OfflineFile)
"""文件数据"""
@dataclass
class ClientStatus:
"""
客户端状态
"""
online: bool = False
"""是否在线"""
status: str = ""
"""状态描述"""
@dataclass
class ClientStatusNoticeEvent(NoticeEvent):
"""
其他客户端在线状态变更通知
"""
client: ClientStatus = field(default_factory=ClientStatus)
"""客户端信息"""
@dataclass
class EssenceNoticeEvent(GroupNoticeEvent):
"""
精华消息变动通知
"""
sub_type: str = ""
"""
子类型
add: 添加
delete: 删除
"""
sender_id: int = 0
"""消息发送者 ID"""
operator_id: int = 0
"""操作者 ID"""
message_id: int = 0
"""消息 ID"""