Skip to content

Commit 770c0df

Browse files
committed
feat(event): add GroupSign
1 parent 2a02b3c commit 770c0df

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

lagrange/client/events/group.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ class GroupNudge(GroupEvent):
5252
attrs_xml: str = field(repr=False)
5353

5454

55+
@dataclass
56+
class GroupSign(GroupEvent):
57+
"""群打卡"""
58+
59+
uin: int
60+
nickname: str
61+
timestamp: int
62+
attrs: Dict[str, Union[str, int]] = field(repr=False)
63+
attrs_xml: str = field(repr=False)
64+
65+
5566
@dataclass
5667
class GroupMuteMember(GroupEvent):
5768
"""when target_uid is empty, mute all member"""

lagrange/client/server_push/msg.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
from lagrange.utils.binary.protobuf import proto_decode, ProtoStruct, proto_encode
1818
from lagrange.utils.binary.reader import Reader
19-
from lagrange.utils.operator import unpack_dict
19+
from lagrange.utils.operator import unpack_dict, timestamp
2020

2121
from ..events.group import (
2222
GroupMemberGotSpecialTitle,
@@ -28,6 +28,7 @@
2828
GroupRecall,
2929
GroupNudge,
3030
GroupReaction,
31+
GroupSign,
3132
)
3233
from ..wtlogin.sso import SSOPacket
3334
from .log import logger
@@ -110,7 +111,14 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
110111
pb.body.attrs_xml,
111112
)
112113
elif pb.body.type == 14: # grp_sign
113-
pass
114+
return GroupSign(
115+
grp_id,
116+
attrs["mqq_uin"],
117+
attrs["mqq_nick"],
118+
timestamp(),
119+
attrs,
120+
pb.body.attrs_xml,
121+
)
114122
else:
115123
raise ValueError(
116124
f"unknown type({pb.body.type}) on GroupSub20: {attrs}"

0 commit comments

Comments
 (0)