Daily build
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user