diff --git a/src/common/config.ts b/src/common/config.ts index 1408b20..8539af0 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -33,7 +33,6 @@ export class ConfigUtil { enableWsReverse: false, messagePostFormat: 'array', enableHttpHeart: false, - enableQOAutoQuote: false, listenLocalhost: false } const defaultConfig: Config = { diff --git a/src/common/types.ts b/src/common/types.ts index 9439806..14baf48 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -10,7 +10,11 @@ export interface OB11Config { enableWsReverse?: boolean messagePostFormat?: 'array' | 'string' enableHttpHeart?: boolean - enableQOAutoQuote: boolean // 快速操作回复自动引用原消息 + /** + * 快速操作回复自动引用原消息 + * @deprecated + */ + enableQOAutoQuote?: boolean listenLocalhost: boolean } diff --git a/src/ntqqapi/api/group.ts b/src/ntqqapi/api/group.ts index 3899218..1158fe8 100644 --- a/src/ntqqapi/api/group.ts +++ b/src/ntqqapi/api/group.ts @@ -117,17 +117,15 @@ export class NTQQGroupApi extends Service { const type = parseInt(flagitem[2]) const session = getSession() if (session) { - return session.getGroupService().operateSysNotify( - false, - { - 'operateType': operateType, // 2 拒绝 - 'targetMsg': { - 'seq': seq, // 通知序列号 - 'type': type, - 'groupCode': groupCode, - 'postscript': reason || ' ' // 仅传空值可能导致处理失败,故默认给个空格 - } - }) + return session.getGroupService().operateSysNotify(false, { + operateType, // 2 拒绝 + targetMsg: { + seq, // 通知序列号 + type, + groupCode, + postscript: reason || ' ' // 仅传空值可能导致处理失败,故默认给个空格 + } + }) } else { return await invoke(NTMethod.HANDLE_GROUP_REQUEST, [{ doubt: false, diff --git a/src/onebot11/action/group/SetGroupAddRequest.ts b/src/onebot11/action/group/SetGroupAddRequest.ts index c20526b..5364a72 100644 --- a/src/onebot11/action/group/SetGroupAddRequest.ts +++ b/src/onebot11/action/group/SetGroupAddRequest.ts @@ -14,9 +14,10 @@ export default class SetGroupAddRequest extends BaseAction { protected async _handle(payload: Payload): Promise { const flag = payload.flag.toString() const approve = payload.approve?.toString() !== 'false' - await this.ctx.ntGroupApi.handleGroupRequest(flag, + await this.ctx.ntGroupApi.handleGroupRequest( + flag, approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject, - payload.reason || '' + payload.reason ) return null } diff --git a/src/onebot11/entities.ts b/src/onebot11/entities.ts index 271b32c..ab77f9f 100644 --- a/src/onebot11/entities.ts +++ b/src/onebot11/entities.ts @@ -165,7 +165,7 @@ export namespace OB11Entities { // 284840486: 合并消息内侧 消息具体定位不到 if (!replyMsg && msg.peerUin !== '284840486') { - ctx.logger.info('queryMsgs', msgList.map(e => pick(e, ['msgSeq', 'msgRandom']))) + ctx.logger.info('queryMsgs', msgList.map(e => pick(e, ['msgSeq', 'msgRandom'])), records.msgRandom) throw new Error('回复消息验证失败') } messageSegment = { diff --git a/src/onebot11/helper/quickOperation.ts b/src/onebot11/helper/quickOperation.ts index 8127015..cf0214e 100644 --- a/src/onebot11/helper/quickOperation.ts +++ b/src/onebot11/helper/quickOperation.ts @@ -1,4 +1,4 @@ -import { OB11Message, OB11MessageAt, OB11MessageData, OB11MessageDataType } from '../types' +import { OB11Message, OB11MessageData, OB11MessageDataType } from '../types' import { OB11FriendRequestEvent } from '../event/request/OB11FriendRequest' import { OB11GroupRequestEvent } from '../event/request/OB11GroupRequest' import { GroupRequestOperateTypes } from '@/ntqqapi/types' @@ -6,7 +6,6 @@ import { convertMessage2List, createSendElements, sendMsg, createPeer, CreatePee import { MessageUnique } from '@/common/utils/messageUnique' import { isNullable } from 'cosmokit' import { Context } from 'cordis' -import { OB11Config } from '@/common/types' interface QuickOperationPrivateMessage { reply?: string @@ -57,7 +56,6 @@ export async function handleQuickOperation(ctx: Context, event: QuickOperationEv async function handleMsg(ctx: Context, msg: OB11Message, quickAction: QuickOperationPrivateMessage | QuickOperationGroupMessage) { const reply = quickAction.reply - const ob11Config: OB11Config = ctx.config let contextMode = CreatePeerMode.Normal if (msg.message_type === 'group') { contextMode = CreatePeerMode.Group @@ -67,23 +65,21 @@ async function handleMsg(ctx: Context, msg: OB11Message, quickAction: QuickOpera const peer = await createPeer(ctx, msg, contextMode) if (reply) { let replyMessage: OB11MessageData[] = [] - if (ob11Config.enableQOAutoQuote) { - replyMessage.push({ - type: OB11MessageDataType.reply, - data: { - id: msg.message_id.toString(), - }, - }) - } + replyMessage.push({ + type: OB11MessageDataType.reply, + data: { + id: msg.message_id.toString(), + }, + }) if (msg.message_type == 'group') { if ((quickAction as QuickOperationGroupMessage).at_sender) { replyMessage.push({ - type: 'at', + type: OB11MessageDataType.at, data: { qq: msg.user_id.toString(), }, - } as OB11MessageAt) + }) } } replyMessage = replyMessage.concat(convertMessage2List(reply, quickAction.auto_escape)) @@ -130,4 +126,4 @@ async function handleGroupRequest(ctx: Context, request: OB11GroupRequestEvent, quickAction.reason, ).catch(e => ctx.logger.error(e)) } -} \ No newline at end of file +} diff --git a/src/renderer/index.ts b/src/renderer/index.ts index 17d16ac..660e703 100644 --- a/src/renderer/index.ts +++ b/src/renderer/index.ts @@ -160,11 +160,6 @@ async function onSettingWindowCreated(view: Element) { `
`, 'config-musicSignUrl', ), - SettingItem( - '快速操作回复自动引用原消息', - null, - SettingSwitch('ob11.enableQOAutoQuote', config.ob11.enableQOAutoQuote), - ), SettingItem( 'HTTP、正向 WebSocket 服务仅监听 127.0.0.1', '而不是 0.0.0.0',