mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
9be43de04b
commit
aa2b4a160d
@ -12,7 +12,7 @@
|
|||||||
"deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"",
|
"deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"",
|
||||||
"format": "prettier -cw .",
|
"format": "prettier -cw .",
|
||||||
"check": "tsc",
|
"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": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -185,7 +185,7 @@ function onLoad() {
|
|||||||
|
|
||||||
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
|
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
|
||||||
startHook()
|
startHook()
|
||||||
await ctx.sleep(350)
|
await ctx.sleep(550)
|
||||||
} else {
|
} else {
|
||||||
llonebotError.otherError = 'LLOneBot 未启动'
|
llonebotError.otherError = 'LLOneBot 未启动'
|
||||||
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
|
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
|
||||||
|
@ -110,8 +110,9 @@ export class NTQQGroupApi extends Service {
|
|||||||
const groupCode = flagitem[0]
|
const groupCode = flagitem[0]
|
||||||
const seq = flagitem[1]
|
const seq = flagitem[1]
|
||||||
const type = parseInt(flagitem[2])
|
const type = parseInt(flagitem[2])
|
||||||
|
const doubt = flagitem[3] === '1'
|
||||||
return await invoke(NTMethod.HANDLE_GROUP_REQUEST, [{
|
return await invoke(NTMethod.HANDLE_GROUP_REQUEST, [{
|
||||||
doubt: false,
|
doubt,
|
||||||
operateMsg: {
|
operateMsg: {
|
||||||
operateType,
|
operateType,
|
||||||
targetMsg: {
|
targetMsg: {
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
BuddyReqType,
|
BuddyReqType,
|
||||||
GrayTipElementSubType
|
GrayTipElementSubType
|
||||||
} from './types'
|
} from './types'
|
||||||
import { selfInfo, llonebotError } from '../common/globalVars'
|
import { selfInfo } from '../common/globalVars'
|
||||||
import { version } from '../version'
|
import { version } from '../version'
|
||||||
import { invoke } from './ntcall'
|
import { invoke } from './ntcall'
|
||||||
import { Native } from './native/index'
|
import { Native } from './native/index'
|
||||||
@ -29,7 +29,7 @@ declare module 'cordis' {
|
|||||||
'nt/message-created': (input: RawMessage) => void
|
'nt/message-created': (input: RawMessage) => void
|
||||||
'nt/message-deleted': (input: RawMessage) => void
|
'nt/message-deleted': (input: RawMessage) => void
|
||||||
'nt/message-sent': (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/friend-request': (input: FriendRequest) => void
|
||||||
'nt/group-member-info-updated': (input: { groupCode: string, members: GroupMember[] }) => void
|
'nt/group-member-info-updated': (input: { groupCode: string, members: GroupMember[] }) => void
|
||||||
'nt/system-message-created': (input: Uint8Array) => void
|
'nt/system-message-created': (input: Uint8Array) => void
|
||||||
@ -228,7 +228,7 @@ class Core extends Service {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
groupNotifyIgnore.push(notify.seq)
|
groupNotifyIgnore.push(notify.seq)
|
||||||
this.ctx.parallel('nt/group-notify', notify)
|
this.ctx.parallel('nt/group-notify', { notify, doubt: payload.doubt })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
595
src/ntqqapi/proto/compiled.d.ts
vendored
595
src/ntqqapi/proto/compiled.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,6 @@ import { OB11Config, Config as LLOBConfig } from '../common/types'
|
|||||||
import { OB11WebSocket, OB11WebSocketReverseManager } from './connect/ws'
|
import { OB11WebSocket, OB11WebSocketReverseManager } from './connect/ws'
|
||||||
import { OB11Http, OB11HttpPost } from './connect/http'
|
import { OB11Http, OB11HttpPost } from './connect/http'
|
||||||
import { OB11BaseEvent } from './event/OB11BaseEvent'
|
import { OB11BaseEvent } from './event/OB11BaseEvent'
|
||||||
import { OB11Message } from './types'
|
|
||||||
import { OB11BaseMetaEvent } from './event/meta/OB11BaseMetaEvent'
|
import { OB11BaseMetaEvent } from './event/meta/OB11BaseMetaEvent'
|
||||||
import { postHttpEvent } from './helper/eventForHttp'
|
import { postHttpEvent } from './helper/eventForHttp'
|
||||||
import { initActionMap } from './action'
|
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 {
|
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 ([GroupNotifyType.MemberLeaveNotifyAdmin, GroupNotifyType.KickMemberNotifyAdmin].includes(notify.type)) {
|
||||||
if (notify.user2.uid) {
|
if (notify.user2.uid) {
|
||||||
this.ctx.logger.info('有群成员被踢', notify.group.groupCode, notify.user1.uid, 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.handleMsg(input)
|
||||||
})
|
})
|
||||||
this.ctx.on('nt/group-notify', 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.ctx.on('nt/friend-request', input => {
|
||||||
this.handleFriendRequest(input)
|
this.handleFriendRequest(input)
|
||||||
@ -370,12 +370,6 @@ class OneBot11Adapter extends Service {
|
|||||||
const userId = Number(memberUin)
|
const userId = Number(memberUin)
|
||||||
const event = new OB11GroupDecreaseEvent(tip.groupCode, userId, userId)
|
const event = new OB11GroupDecreaseEvent(tip.groupCode, userId, userId)
|
||||||
this.dispatch(event)
|
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)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,6 @@ export namespace OB11Entities {
|
|||||||
ctx.logger.info('收到新人被邀请进群消息', xmlElement)
|
ctx.logger.info('收到新人被邀请进群消息', xmlElement)
|
||||||
const invitor = xmlElement.templParam.get('invitor')
|
const invitor = xmlElement.templParam.get('invitor')
|
||||||
const invitee = xmlElement.templParam.get('invitee')
|
const invitee = xmlElement.templParam.get('invitee')
|
||||||
if (invitee === selfInfo.uin) return
|
|
||||||
if (invitor && invitee) {
|
if (invitor && invitee) {
|
||||||
return new OB11GroupIncreaseEvent(+msg.peerUid, +invitee, +invitor, 'invite')
|
return new OB11GroupIncreaseEvent(+msg.peerUid, +invitee, +invitor, 'invite')
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class SatoriAdapter extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleGroupNotify(input: NT.GroupNotify) {
|
async handleGroupNotify(input: NT.GroupNotify, doubt: boolean) {
|
||||||
if (
|
if (
|
||||||
input.type === NT.GroupNotifyType.InvitedByMember &&
|
input.type === NT.GroupNotifyType.InvitedByMember &&
|
||||||
input.status === NT.GroupNotifyStatus.Unhandle
|
input.status === NT.GroupNotifyStatus.Unhandle
|
||||||
@ -119,14 +119,14 @@ class SatoriAdapter extends Service {
|
|||||||
input.status === NT.GroupNotifyStatus.Unhandle
|
input.status === NT.GroupNotifyStatus.Unhandle
|
||||||
) {
|
) {
|
||||||
// 他人主动申请,需管理员同意
|
// 他人主动申请,需管理员同意
|
||||||
return await parseGuildMemberRequest(this, input)
|
return await parseGuildMemberRequest(this, input, doubt)
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
input.type === NT.GroupNotifyType.InvitedNeedAdminiStratorPass &&
|
input.type === NT.GroupNotifyType.InvitedNeedAdminiStratorPass &&
|
||||||
input.status === NT.GroupNotifyStatus.Unhandle
|
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 => {
|
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))
|
.catch(e => this.ctx.logger.error(e))
|
||||||
event && this.server.dispatch(event)
|
event && this.server.dispatch(event)
|
||||||
})
|
})
|
||||||
|
@ -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 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', {
|
return bot.event('guild-member-request', {
|
||||||
guild: decodeGuild(input.group),
|
guild: decodeGuild(input.group),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user