2021-01-30 06:10:04 +08:00
|
|
|
|
from typing import Any, Optional
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
from pydantic import Field
|
|
|
|
|
|
2021-02-01 00:01:31 +08:00
|
|
|
|
from .base import Event, GroupChatInfo, GroupInfo, UserPermission
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class NoticeEvent(Event):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""通知事件基类"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class MuteEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""禁言类事件基类"""
|
|
|
|
|
operator: GroupChatInfo
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class BotMuteEvent(MuteEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot被禁言"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class BotUnmuteEvent(MuteEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot被取消禁言"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class MemberMuteEvent(MuteEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群成员被禁言事件(该成员不是Bot)"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
duration_seconds: int = Field(alias='durationSeconds')
|
2021-02-01 00:01:31 +08:00
|
|
|
|
member: GroupChatInfo
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class MemberUnmuteEvent(MuteEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群成员被取消禁言事件(该成员不是Bot)"""
|
|
|
|
|
member: GroupChatInfo
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class BotJoinGroupEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot加入了一个新群"""
|
|
|
|
|
group: GroupInfo
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BotLeaveEventActive(BotJoinGroupEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot主动退出一个群"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BotLeaveEventKick(BotJoinGroupEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot被踢出一个群"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class MemberJoinEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""新人入群的事件"""
|
|
|
|
|
member: GroupChatInfo
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-02-01 00:01:31 +08:00
|
|
|
|
class MemberLeaveEventKick(MemberJoinEvent):
|
|
|
|
|
"""成员被踢出群(该成员不是Bot)"""
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-02-01 00:01:31 +08:00
|
|
|
|
class MemberLeaveEventQuit(MemberJoinEvent):
|
|
|
|
|
"""成员主动离群(该成员不是Bot)"""
|
|
|
|
|
pass
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class FriendRecallEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""好友消息撤回"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
author_id: int = Field(alias='authorId')
|
|
|
|
|
message_id: int = Field(alias='messageId')
|
|
|
|
|
time: int
|
|
|
|
|
operator: int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupRecallEvent(FriendRecallEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群消息撤回"""
|
|
|
|
|
group: GroupInfo
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class GroupStateChangeEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群变化事件基类"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: Any
|
|
|
|
|
current: Any
|
2021-02-01 00:01:31 +08:00
|
|
|
|
group: GroupInfo
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupNameChangeEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""某个群名改变"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: str
|
|
|
|
|
current: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupEntranceAnnouncementChangeEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""某群入群公告改变"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: str
|
|
|
|
|
current: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupMuteAllEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""全员禁言"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: bool
|
|
|
|
|
current: bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupAllowAnonymousChatEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""匿名聊天"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: bool
|
|
|
|
|
current: bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupAllowConfessTalkEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""坦白说"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: bool
|
|
|
|
|
current: bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupAllowMemberInviteEvent(GroupStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""允许群员邀请好友加群"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: bool
|
|
|
|
|
current: bool
|
|
|
|
|
|
|
|
|
|
|
2021-01-29 21:19:13 +08:00
|
|
|
|
class MemberStateChangeEvent(NoticeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群成员变化事件基类"""
|
|
|
|
|
member: GroupChatInfo
|
|
|
|
|
operator: Optional[GroupChatInfo] = None
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemberCardChangeEvent(MemberStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群名片改动"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: str
|
|
|
|
|
current: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemberSpecialTitleChangeEvent(MemberStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""群头衔改动(只有群主有操作限权)"""
|
2021-01-29 17:38:39 +08:00
|
|
|
|
origin: str
|
|
|
|
|
current: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BotGroupPermissionChangeEvent(MemberStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""Bot在群里的权限被改变"""
|
|
|
|
|
origin: UserPermission
|
|
|
|
|
current: UserPermission
|
2021-01-29 17:38:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MemberPermissionChangeEvent(MemberStateChangeEvent):
|
2021-02-01 00:01:31 +08:00
|
|
|
|
"""成员权限改变的事件(该成员不是Bot)"""
|
|
|
|
|
origin: UserPermission
|
|
|
|
|
current: UserPermission
|