This commit is contained in:
idranme 2024-10-26 00:15:48 +08:00
parent 9be43de04b
commit aa2b4a160d
No known key found for this signature in database
GPG Key ID: D0F3677546E6ECD5
10 changed files with 18 additions and 1633 deletions

View File

@ -12,7 +12,7 @@
"deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"",
"format": "prettier -cw .",
"check": "tsc",
"compile:proto": "pbjs --no-create --no-convert --no-verify -t static-module -w es6 -p src/ntqqapi/proto -o src/ntqqapi/proto/compiled.js profileLikeTip.proto groupNotify.proto message.proto richMedia.proto && pbts -o src/ntqqapi/proto/compiled.d.ts src/ntqqapi/proto/compiled.js"
"compile:proto": "pbjs --no-create --no-convert --no-delimited --no-verify -t static-module -w es6 -p src/ntqqapi/proto -o src/ntqqapi/proto/compiled.js profileLikeTip.proto groupNotify.proto message.proto richMedia.proto && pbts -o src/ntqqapi/proto/compiled.d.ts src/ntqqapi/proto/compiled.js"
},
"author": "",
"license": "MIT",

View File

@ -185,7 +185,7 @@ function onLoad() {
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
startHook()
await ctx.sleep(350)
await ctx.sleep(550)
} else {
llonebotError.otherError = 'LLOneBot 未启动'
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')

View File

@ -110,8 +110,9 @@ export class NTQQGroupApi extends Service {
const groupCode = flagitem[0]
const seq = flagitem[1]
const type = parseInt(flagitem[2])
const doubt = flagitem[3] === '1'
return await invoke(NTMethod.HANDLE_GROUP_REQUEST, [{
doubt: false,
doubt,
operateMsg: {
operateType,
targetMsg: {

View File

@ -16,7 +16,7 @@ import {
BuddyReqType,
GrayTipElementSubType
} from './types'
import { selfInfo, llonebotError } from '../common/globalVars'
import { selfInfo } from '../common/globalVars'
import { version } from '../version'
import { invoke } from './ntcall'
import { Native } from './native/index'
@ -29,7 +29,7 @@ declare module 'cordis' {
'nt/message-created': (input: RawMessage) => void
'nt/message-deleted': (input: RawMessage) => void
'nt/message-sent': (input: RawMessage) => void
'nt/group-notify': (input: GroupNotify) => void
'nt/group-notify': (input: { notify: GroupNotify, doubt: boolean }) => void
'nt/friend-request': (input: FriendRequest) => void
'nt/group-member-info-updated': (input: { groupCode: string, members: GroupMember[] }) => void
'nt/system-message-created': (input: Uint8Array) => void
@ -228,7 +228,7 @@ class Core extends Service {
continue
}
groupNotifyIgnore.push(notify.seq)
this.ctx.parallel('nt/group-notify', notify)
this.ctx.parallel('nt/group-notify', { notify, doubt: payload.doubt })
}
}
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@ import { OB11Config, Config as LLOBConfig } from '../common/types'
import { OB11WebSocket, OB11WebSocketReverseManager } from './connect/ws'
import { OB11Http, OB11HttpPost } from './connect/http'
import { OB11BaseEvent } from './event/OB11BaseEvent'
import { OB11Message } from './types'
import { OB11BaseMetaEvent } from './event/meta/OB11BaseMetaEvent'
import { postHttpEvent } from './helper/eventForHttp'
import { initActionMap } from './action'
@ -88,9 +87,9 @@ class OneBot11Adapter extends Service {
}
}
private async handleGroupNotify(notify: GroupNotify) {
private async handleGroupNotify(notify: GroupNotify, doubt: boolean) {
try {
const flag = notify.group.groupCode + '|' + notify.seq + '|' + notify.type
const flag = `${notify.group.groupCode}|${notify.seq}|${notify.type}|${doubt === true ? '1' : '0'}`
if ([GroupNotifyType.MemberLeaveNotifyAdmin, GroupNotifyType.KickMemberNotifyAdmin].includes(notify.type)) {
if (notify.user2.uid) {
this.ctx.logger.info('有群成员被踢', notify.group.groupCode, notify.user1.uid, notify.user2.uid)
@ -338,7 +337,8 @@ class OneBot11Adapter extends Service {
this.handleMsg(input)
})
this.ctx.on('nt/group-notify', input => {
this.handleGroupNotify(input)
const { doubt, notify } = input
this.handleGroupNotify(notify, doubt)
})
this.ctx.on('nt/friend-request', input => {
this.handleFriendRequest(input)
@ -370,12 +370,6 @@ class OneBot11Adapter extends Service {
const userId = Number(memberUin)
const event = new OB11GroupDecreaseEvent(tip.groupCode, userId, userId)
this.dispatch(event)
} else if (msgType === 87) {
const tip = SysMsg.GroupInvite.decode(sysMsg.body!.msgContent!)
this.ctx.logger.info('群成员增加', tip)
const operatorUin = await this.ctx.ntUserApi.getUinByUid(tip.operatorUid)
const event = new OB11GroupIncreaseEvent(tip.groupCode, +selfInfo.uin, +operatorUin, 'invite')
this.dispatch(event)
}
})
}

View File

@ -520,7 +520,6 @@ export namespace OB11Entities {
ctx.logger.info('收到新人被邀请进群消息', xmlElement)
const invitor = xmlElement.templParam.get('invitor')
const invitee = xmlElement.templParam.get('invitee')
if (invitee === selfInfo.uin) return
if (invitor && invitee) {
return new OB11GroupIncreaseEvent(+msg.peerUid, +invitee, +invitor, 'invite')
}

View File

@ -99,7 +99,7 @@ class SatoriAdapter extends Service {
}
}
async handleGroupNotify(input: NT.GroupNotify) {
async handleGroupNotify(input: NT.GroupNotify, doubt: boolean) {
if (
input.type === NT.GroupNotifyType.InvitedByMember &&
input.status === NT.GroupNotifyStatus.Unhandle
@ -119,14 +119,14 @@ class SatoriAdapter extends Service {
input.status === NT.GroupNotifyStatus.Unhandle
) {
// 他人主动申请,需管理员同意
return await parseGuildMemberRequest(this, input)
return await parseGuildMemberRequest(this, input, doubt)
}
else if (
input.type === NT.GroupNotifyType.InvitedNeedAdminiStratorPass &&
input.status === NT.GroupNotifyStatus.Unhandle
) {
// 他人被邀请,需管理员同意
return await parseGuildMemberRequest(this, input)
return await parseGuildMemberRequest(this, input, doubt)
}
}
@ -140,7 +140,8 @@ class SatoriAdapter extends Service {
})
this.ctx.on('nt/group-notify', async input => {
const event = await this.handleGroupNotify(input)
const { doubt, notify } = input
const event = await this.handleGroupNotify(notify, doubt)
.catch(e => this.ctx.logger.error(e))
event && this.server.dispatch(event)
})

View File

@ -46,9 +46,9 @@ export async function parseGuildMemberRemoved(bot: SatoriAdapter, input: GroupNo
})
}
export async function parseGuildMemberRequest(bot: SatoriAdapter, input: GroupNotify) {
export async function parseGuildMemberRequest(bot: SatoriAdapter, input: GroupNotify, doubt: boolean) {
const groupCode = input.group.groupCode
const flag = groupCode + '|' + input.seq + '|' + input.type
const flag = `${groupCode}|${input.seq}|${input.type}|${doubt === true ? '1' : '0'}`
return bot.event('guild-member-request', {
guild: decodeGuild(input.group),