22using Lagrange . Core . Events . EventArgs ;
33using Lagrange . Core . Internal . Events ;
44using Lagrange . Core . Internal . Events . Message ;
5+ using Lagrange . Core . Internal . Packets . Notify ;
6+ using Lagrange . Core . Utility . Binary ;
7+ using ProtoHelper = Lagrange . Core . Utility . ProtoHelper ;
58
69namespace Lagrange . Core . Internal . Logic ;
710
@@ -20,6 +23,34 @@ public async ValueTask Incoming(ProtocolEvent e)
2023 var message = await context . EventContext . GetLogic < MessagingLogic > ( ) . Parse ( messageEvent . MsgPush . CommonMessage ) ;
2124 context . EventInvoker . PostEvent ( new BotMessageEvent ( message , messageEvent . Raw ) ) ;
2225 break ;
26+ case Type . Event0x2DC :
27+ var pkgType = ( Event0x2DCSubType ) messageEvent . MsgPush . CommonMessage . ContentHead . SubType ;
28+ switch ( pkgType )
29+ {
30+ case Event0x2DCSubType . GroupGreyTipNotice20 when messageEvent . MsgPush . CommonMessage . MessageBody . MsgContent is { } content :
31+ var packet = new BinaryPacket ( content ) ;
32+ Int64 groupUin = packet . Read < Int32 > ( ) ; // group uin
33+ _ = packet . Read < byte > ( ) ; // unknown byte
34+ var proto = packet . ReadBytes ( Prefix . Int16 | Prefix . LengthOnly ) ;
35+ var greyTip = ProtoHelper . Deserialize < NotifyMessageBody > ( proto ) ;
36+ var templates = greyTip . GeneralGrayTip . MsgTemplParam . ToDictionary ( x => x . Name , x => x . Value ) ;
37+
38+ if ( ! templates . TryGetValue ( "action_str" , out var actionStr ) && ! templates . TryGetValue ( "alt_str1" , out actionStr ) )
39+ {
40+ actionStr = string . Empty ;
41+ }
42+
43+ if ( greyTip . GeneralGrayTip . BusiType == 12 ) // poke
44+ {
45+ context . EventInvoker . PostEvent ( new BotGroupNudgeEvent (
46+ groupUin ,
47+ uint . Parse ( templates [ "uin_str1" ] ) ,
48+ uint . Parse ( templates [ "uin_str2" ] ) )
49+ ) ;
50+ }
51+ break ;
52+ }
53+ break ;
2354 }
2455 }
2556
@@ -28,5 +59,24 @@ private enum Type
2859 PrivateMessage = 166 ,
2960 GroupMessage = 82 ,
3061 TempMessage = 141 ,
62+ Event0x210 = 528 , // friend related event
63+ Event0x2DC = 732 , // group related event
64+ }
65+
66+ private enum Event0x2DCSubType
67+ {
68+ GroupMuteNotice = 12 ,
69+ SubType16 = 16 ,
70+ GroupRecallNotice = 17 ,
71+ GroupGreyTipNotice21 = 21 ,
72+ GroupGreyTipNotice20 = 20 ,
73+ }
74+
75+ private enum Event0x2DCSubType16Field13
76+ {
77+ GroupMemberSpecialTitleNotice = 6 ,
78+ GroupNameChangeNotice = 12 ,
79+ GroupTodoNotice = 23 ,
80+ GroupReactionNotice = 35 ,
3181 }
32- }
82+ }
0 commit comments