forked from LagrangeDev/lagrange-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroup.py
More file actions
144 lines (105 loc) · 2.59 KB
/
Copy pathgroup.py
File metadata and controls
144 lines (105 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, List, Optional, Union, Dict
from . import BaseEvent
if TYPE_CHECKING:
from lagrange.client.message.types import Element
@dataclass
class MessageInfo:
uid: str
seq: int
time: int
rand: int
@dataclass
class GroupEvent(BaseEvent):
grp_id: int
@dataclass
class GroupMessage(GroupEvent, MessageInfo):
uin: int
grp_name: str
nickname: str
sub_id: int = field(repr=False) # client ver identify
sender_type: int = field(repr=False)
msg: str
msg_chain: List[Element]
@property
def is_bot(self) -> bool:
return self.sender_type == 3091
@dataclass
class GroupRecall(GroupEvent, MessageInfo):
suffix: str
@dataclass
class GroupNudge(GroupEvent):
sender_uin: int
target_uin: int
action: str
suffix: str
attrs: Dict[str, Union[str, int]] = field(repr=False)
attrs_xml: str = field(repr=False)
@dataclass
class GroupSign(GroupEvent):
"""群打卡"""
uin: int
nickname: str
timestamp: int
attrs: Dict[str, Union[str, int]] = field(repr=False)
attrs_xml: str = field(repr=False)
@dataclass
class GroupMuteMember(GroupEvent):
"""when target_uid is empty, mute all member"""
operator_uid: str
target_uid: str
duration: int
@dataclass
class GroupMemberJoinRequest(GroupEvent):
uid: str
invitor_uid: Optional[str] = None
answer: Optional[str] = None # 问题:(.*)答案:(.*)
@dataclass
class GroupMemberJoined(GroupEvent):
uin: int
uid: str
join_type: int
@dataclass
class GroupMemberQuit(GroupEvent):
uin: int
uid: str
exit_type: int
operator_uid: str = ""
@property
def is_kicked(self) -> bool:
return self.exit_type in [3, 131]
@property
def is_kicked_self(self) -> bool:
return self.exit_type == 3
@dataclass
class GroupMemberGotSpecialTitle(GroupEvent):
grp_id: int
member_uin: int
special_title: str
_detail_url: str = ""
@dataclass
class GroupNameChanged(GroupEvent):
name_new: str
timestamp: int
operator_uid: str
@dataclass
class GroupReaction(GroupEvent):
uid: str
seq: int
emoji_id: int
emoji_type: int
emoji_count: int
type: int
total_operations: int
@property
def is_increase(self) -> bool:
return self.type == 1
@property
def is_emoji(self) -> bool:
return self.emoji_type == 2
@dataclass
class GroupAlbumUpdate(GroupEvent):
"""群相册更新(上传)"""
timestamp: int
image_id: str