@@ -103,21 +103,7 @@ class OneBot11Adapter extends Service {
103103 private async handleGroupNotify ( notify : GroupNotify , doubt : boolean ) {
104104 try {
105105 const flag = `${ notify . group . groupCode } |${ notify . seq } |${ notify . type } |${ doubt ? '1' : '0' } `
106- if ( [ GroupNotifyType . MemberLeaveNotifyAdmin , GroupNotifyType . KickMemberNotifyAdmin ] . includes ( notify . type ) ) {
107- if ( notify . user2 . uid ) {
108- this . ctx . logger . info ( '有群成员被踢' , notify . group . groupCode , notify . user1 . uid , notify . user2 . uid )
109- const memberUin = await this . ctx . ntUserApi . getUinByUid ( notify . user1 . uid )
110- const adminUin = await this . ctx . ntUserApi . getUinByUid ( notify . user2 . uid )
111- const event = new OB11GroupDecreaseEvent (
112- parseInt ( notify . group . groupCode ) ,
113- parseInt ( memberUin ) ,
114- parseInt ( adminUin ) ,
115- 'kick' ,
116- )
117- this . dispatch ( event )
118- }
119- }
120- else if ( notify . type === GroupNotifyType . RequestJoinNeedAdminiStratorPass && notify . status === GroupNotifyStatus . Unhandle ) {
106+ if ( notify . type === GroupNotifyType . RequestJoinNeedAdminiStratorPass && notify . status === GroupNotifyStatus . Unhandle ) {
121107 this . ctx . logger . info ( '有加群请求' )
122108 const requestUin = await this . ctx . ntUserApi . getUinByUid ( notify . user1 . uid )
123109 const event = new OB11GroupRequestEvent (
@@ -317,7 +303,7 @@ class OneBot11Adapter extends Service {
317303 if ( input . senderUid === selfInfo . uid ) {
318304 this . handleMsg ( input , true , false )
319305 }
320- else {
306+ else {
321307 this . handleMsg ( input , false , false )
322308 }
323309 } )
@@ -364,12 +350,20 @@ class OneBot11Adapter extends Service {
364350 }
365351 else if ( msgType === 34 ) {
366352 const tip = SysMsg . GroupMemberChange . decode ( sysMsg . body ! . msgContent ! )
367- if ( tip . type !== 130 ) return // adminUid: 0
368- this . ctx . logger . info ( '群成员减少' , tip )
369- const memberUin = await this . ctx . ntUserApi . getUinByUid ( tip . memberUid )
370- const userId = Number ( memberUin )
371- const event = new OB11GroupDecreaseEvent ( tip . groupCode , userId , userId )
372- this . dispatch ( event )
353+ if ( tip . type === 130 ) {
354+ this . ctx . logger . info ( '群成员减少' , tip )
355+ const memberUin = await this . ctx . ntUserApi . getUinByUid ( tip . memberUid )
356+ const userId = Number ( memberUin )
357+ const event = new OB11GroupDecreaseEvent ( tip . groupCode , userId , userId )
358+ this . dispatch ( event )
359+ } else if ( tip . type === 131 ) {
360+ if ( tip . memberUid === selfInfo . uid ) return
361+ this . ctx . logger . info ( '有群成员被踢' , tip )
362+ const memberUin = await this . ctx . ntUserApi . getUinByUid ( tip . memberUid )
363+ const adminUin = await this . ctx . ntUserApi . getUinByUid ( tip . adminUid . match ( / \x18 ( [ ^ \x18 \x10 ] + ) \x10 / ) ! [ 1 ] )
364+ const event = new OB11GroupDecreaseEvent ( tip . groupCode , + memberUin , + adminUin , 'kick' )
365+ this . dispatch ( event )
366+ }
373367 }
374368 else if ( msgType === 528 && subType === 321 ) {
375369 // 私聊撤回戳一戳,不再从这里解析,应从 nt/message-deleted 事件中解析
0 commit comments