diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f6b1d23 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +* text eol=lf + +*.png -text +*.jpg -text +*.ico -text +*.gif -text +*.webp -text diff --git a/package.json b/package.json index e0fef99..cb94849 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "electron-vite": "^2.3.0", "protobufjs-cli": "^1.1.3", "typescript": "^5.6.2", - "vite": "^5.4.5", + "vite": "^5.4.6", "vite-plugin-cp": "^4.0.8" }, "packageManager": "yarn@4.4.1" diff --git a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts index 4e16cff..53f3c47 100644 --- a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { OB11ForwardMessage } from '../../types' import { OB11Entities } from '../../entities' import { ActionName } from '../types' @@ -16,6 +16,11 @@ interface Response { export class GetForwardMsg extends BaseAction { actionName = ActionName.GoCQHTTP_GetForwardMsg + payloadSchema = Schema.object({ + message_id: String, + id: String + }) + protected async _handle(payload: Payload) { const msgId = payload.id || payload.message_id if (!msgId) { diff --git a/src/onebot11/action/go-cqhttp/GetGroupAtAllRemain.ts b/src/onebot11/action/go-cqhttp/GetGroupAtAllRemain.ts index d39032a..31bc17b 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupAtAllRemain.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupAtAllRemain.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { ActionName } from '../types' interface Payload { @@ -13,6 +13,9 @@ interface Response { export class GetGroupAtAllRemain extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain + payloadSchema = Schema.object({ + group_id: Schema.union([Number, String]).required() + }) async _handle(payload: Payload) { const data = await this.ctx.ntGroupApi.getGroupRemainAtTimes(payload.group_id.toString()) diff --git a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts index 5227976..1dd0b0c 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { OB11Message } from '../../types' import { ActionName } from '../types' import { ChatType } from '@/ntqqapi/types' @@ -10,8 +10,8 @@ import { filterNullable } from '@/common/utils/misc' interface Payload { group_id: number | string message_seq?: number | string - count?: number | string - reverseOrder?: boolean + count: number | string + reverseOrder: boolean } interface Response { @@ -20,10 +20,15 @@ interface Response { export class GetGroupMsgHistory extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupMsgHistory + payloadSchema = Schema.object({ + group_id: Schema.union([Number, String]).required(), + message_seq: Schema.union([Number, String]), + count: Schema.union([Number, String]).default(20), + reverseOrder: Schema.boolean().default(false), + }) protected async _handle(payload: Payload): Promise { - const count = payload.count || 20 - const isReverseOrder = payload.reverseOrder || true + const { count, reverseOrder } = payload const peer = { chatType: ChatType.group, peerUid: payload.group_id.toString() } let msgList: RawMessage[] | undefined // 包含 message_seq 0 @@ -35,7 +40,7 @@ export class GetGroupMsgHistory extends BaseAction { msgList = (await this.ctx.ntMsgApi.getMsgHistory(peer, startMsgId, +count)).msgList } if (!msgList?.length) throw new Error('未找到消息') - if (isReverseOrder) msgList.reverse() + if (reverseOrder) msgList.reverse() await Promise.all( msgList.map(async msg => { msg.msgShortId = MessageUnique.createMsg({ chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId) diff --git a/src/onebot11/action/go-cqhttp/GetGroupRootFiles.ts b/src/onebot11/action/go-cqhttp/GetGroupRootFiles.ts index 65952f9..ab3e5bf 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupRootFiles.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupRootFiles.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { ActionName } from '../types' import { OB11GroupFile, OB11GroupFileFolder } from '../../types' @@ -14,18 +14,19 @@ interface Response { export class GetGroupRootFiles extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupRootFiles + payloadSchema = Schema.object({ + group_id: Schema.union([Number, String]).required(), + file_count: Schema.union([Number, String]).default(50), + }) async _handle(payload: Payload) { const data = await this.ctx.ntGroupApi.getGroupFileList(payload.group_id.toString(), { sortType: 1, - fileCount: +(payload.file_count ?? 50), + fileCount: +payload.file_count, startIndex: 0, sortOrder: 2, showOnlinedocFolder: 0, }) - - this.ctx.logger.info(data) - return { files: data.filter(item => item.fileInfo) .map(item => { diff --git a/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts index 4980bb7..d485b8c 100644 --- a/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot11/action/go-cqhttp/GetStrangerInfo.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { OB11User } from '../../types' import { OB11Entities } from '../../entities' import { ActionName } from '../types' @@ -12,6 +12,9 @@ interface Payload { export class GetStrangerInfo extends BaseAction { actionName = ActionName.GoCQHTTP_GetStrangerInfo + payloadSchema = Schema.object({ + user_id: Schema.union([Number, String]).required() + }) protected async _handle(payload: Payload): Promise { if (!(getBuildVersion() >= 26702)) { diff --git a/src/onebot11/action/go-cqhttp/MarkMsgAsRead.ts b/src/onebot11/action/go-cqhttp/MarkMsgAsRead.ts index faaeb64..8c73cae 100644 --- a/src/onebot11/action/go-cqhttp/MarkMsgAsRead.ts +++ b/src/onebot11/action/go-cqhttp/MarkMsgAsRead.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { ActionName } from '../types' import { MessageUnique } from '@/common/utils/messageUnique' @@ -8,11 +8,11 @@ interface Payload { export class MarkMsgAsRead extends BaseAction { actionName = ActionName.GoCQHTTP_MarkMsgAsRead + payloadSchema = Schema.object({ + message_id: Schema.union([Number, String]).required() + }) protected async _handle(payload: Payload) { - if (!payload.message_id) { - throw new Error('参数 message_id 不能为空') - } const msg = await MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id) if (!msg) { throw new Error('msg not found') diff --git a/src/onebot11/action/go-cqhttp/QuickOperation.ts b/src/onebot11/action/go-cqhttp/QuickOperation.ts index fc2c080..00ffb49 100644 --- a/src/onebot11/action/go-cqhttp/QuickOperation.ts +++ b/src/onebot11/action/go-cqhttp/QuickOperation.ts @@ -9,6 +9,7 @@ interface Payload { export class HandleQuickOperation extends BaseAction { actionName = ActionName.GoCQHTTP_HandleQuickOperation + protected async _handle(payload: Payload): Promise { handleQuickOperation(this.ctx, payload.context, payload.operation).catch(e => this.ctx.logger.error(e)) return null diff --git a/src/onebot11/action/go-cqhttp/SendForwardMsg.ts b/src/onebot11/action/go-cqhttp/SendForwardMsg.ts index d9476f4..c76cd63 100644 --- a/src/onebot11/action/go-cqhttp/SendForwardMsg.ts +++ b/src/onebot11/action/go-cqhttp/SendForwardMsg.ts @@ -1,20 +1,180 @@ -import SendMsg from '../msg/SendMsg' -import { OB11PostSendMsg } from '../../types' +import { unlink } from 'node:fs/promises' +import { OB11MessageNode } from '../../types' import { ActionName } from '../types' +import { BaseAction, Schema } from '../BaseAction' +import { Peer } from '@/ntqqapi/types/msg' +import { ChatType, ElementType, RawMessage, SendMessageElement } from '@/ntqqapi/types' +import { MessageUnique } from '@/common/utils/messageUnique' +import { selfInfo } from '@/common/globalVars' +import { convertMessage2List, createSendElements, sendMsg, createPeer, CreatePeerMode } from '../../helper/createMessage' -export class SendForwardMsg extends SendMsg { +interface Payload { + user_id?: string | number + group_id?: string | number + messages: OB11MessageNode[] + message_type?: 'group' | 'private' +} + +interface Response { + message_id: number + forward_id?: string +} + +export class SendForwardMsg extends BaseAction { actionName = ActionName.GoCQHTTP_SendForwardMsg + payloadSchema = Schema.object({ + user_id: Schema.union([Number, String]), + group_id: Schema.union([Number, String]), + messages: Schema.array(Schema.any()).required(), + message_type: Schema.union(['group', 'private']) + }) - protected async _handle(payload: OB11PostSendMsg) { - if (payload.messages) payload.message = payload.messages - return super._handle(payload) + protected async _handle(payload: Payload) { + let contextMode = CreatePeerMode.Normal + if (payload.message_type === 'group') { + contextMode = CreatePeerMode.Group + } else if (payload.message_type === 'private') { + contextMode = CreatePeerMode.Private + } + const peer = await createPeer(this.ctx, payload, contextMode) + const returnMsg = await this.handleForwardNode(peer, payload.messages) + return { message_id: returnMsg.msgShortId! } + } + + private async cloneMsg(msg: RawMessage): Promise { + this.ctx.logger.info('克隆的目标消息', msg) + const sendElements: SendMessageElement[] = [] + for (const ele of msg.elements) { + sendElements.push(ele as SendMessageElement) + } + if (sendElements.length === 0) { + this.ctx.logger.warn('需要clone的消息无法解析,将会忽略掉', msg) + } + this.ctx.logger.info('克隆消息', sendElements) + try { + const peer = { + chatType: ChatType.friend, + peerUid: selfInfo.uid + } + const nodeMsg = await this.ctx.ntMsgApi.sendMsg(peer, sendElements) + await this.ctx.sleep(400) + return nodeMsg + } catch (e) { + this.ctx.logger.warn(e, '克隆转发消息失败,将忽略本条消息', msg) + } + } + + // 返回一个合并转发的消息id + private async handleForwardNode(destPeer: Peer, messageNodes: OB11MessageNode[]) { + const selfPeer = { + chatType: ChatType.friend, + peerUid: selfInfo.uid, + } + let nodeMsgIds: string[] = [] + // 先判断一遍是不是id和自定义混用 + for (const messageNode of messageNodes) { + // 一个node表示一个人的消息 + const nodeId = messageNode.data.id + // 有nodeId表示一个子转发消息卡片 + if (nodeId) { + const nodeMsg = await MessageUnique.getMsgIdAndPeerByShortId(+nodeId) || await MessageUnique.getPeerByMsgId(nodeId) + if (!nodeMsg) { + this.ctx.logger.warn('转发消息失败,未找到消息', nodeId) + continue + } + nodeMsgIds.push(nodeMsg.MsgId) + } + else { + // 自定义的消息 + // 提取消息段,发给自己生成消息id + try { + const { sendElements, deleteAfterSentFiles } = await createSendElements( + this.ctx, + convertMessage2List(messageNode.data.content), + destPeer + ) + this.ctx.logger.info('开始生成转发节点', sendElements) + const sendElementsSplit: SendMessageElement[][] = [] + let splitIndex = 0 + for (const ele of sendElements) { + if (!sendElementsSplit[splitIndex]) { + sendElementsSplit[splitIndex] = [] + } + + if (ele.elementType === ElementType.FILE || ele.elementType === ElementType.VIDEO) { + if (sendElementsSplit[splitIndex].length > 0) { + splitIndex++ + } + sendElementsSplit[splitIndex] = [ele] + splitIndex++ + } + else { + sendElementsSplit[splitIndex].push(ele) + } + this.ctx.logger.info(sendElementsSplit) + } + // log("分割后的转发节点", sendElementsSplit) + for (const eles of sendElementsSplit) { + const nodeMsg = await sendMsg(this.ctx, selfPeer, eles, []) + if (!nodeMsg) { + this.ctx.logger.warn('转发节点生成失败', eles) + continue + } + nodeMsgIds.push(nodeMsg.msgId) + await this.ctx.sleep(400) + } + deleteAfterSentFiles.map(path => unlink(path)) + } catch (e) { + this.ctx.logger.error('生成转发消息节点失败', e) + } + } + } + + // 检查srcPeer是否一致,不一致则需要克隆成自己的消息, 让所有srcPeer都变成自己的,使其保持一致才能够转发 + const nodeMsgArray: RawMessage[] = [] + let srcPeer: Peer | null = null + let needSendSelf = false + for (const msgId of nodeMsgIds) { + const nodeMsgPeer = await MessageUnique.getPeerByMsgId(msgId) + if (nodeMsgPeer) { + const nodeMsg = (await this.ctx.ntMsgApi.getMsgsByMsgId(nodeMsgPeer.Peer, [msgId])).msgList[0] + srcPeer = srcPeer ?? { chatType: nodeMsg.chatType, peerUid: nodeMsg.peerUid } + if (srcPeer.peerUid !== nodeMsg.peerUid) { + needSendSelf = true + } + nodeMsgArray.push(nodeMsg) + } + } + nodeMsgIds = nodeMsgArray.map((msg) => msg.msgId) + if (needSendSelf) { + for (const msg of nodeMsgArray) { + if (msg.peerUid === selfPeer.peerUid) continue + await this.cloneMsg(msg) + } + } + if (nodeMsgIds.length === 0) { + throw Error('转发消息失败,节点为空') + } + const returnMsg = await this.ctx.ntMsgApi.multiForwardMsg(srcPeer!, destPeer, nodeMsgIds) + returnMsg.msgShortId = MessageUnique.createMsg(destPeer, returnMsg.msgId) + return returnMsg } } export class SendPrivateForwardMsg extends SendForwardMsg { actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg + + protected _handle(payload: Payload) { + payload.message_type = 'private' + return super._handle(payload) + } } export class SendGroupForwardMsg extends SendForwardMsg { actionName = ActionName.GoCQHTTP_SendGroupForwardMsg + + protected _handle(payload: Payload) { + payload.message_type = 'group' + return super._handle(payload) + } } diff --git a/src/onebot11/action/go-cqhttp/SendGroupNotice.ts b/src/onebot11/action/go-cqhttp/SendGroupNotice.ts index 9bac373..c1575f0 100644 --- a/src/onebot11/action/go-cqhttp/SendGroupNotice.ts +++ b/src/onebot11/action/go-cqhttp/SendGroupNotice.ts @@ -1,4 +1,4 @@ -import { BaseAction } from '../BaseAction' +import { BaseAction, Schema } from '../BaseAction' import { ActionName } from '../types' import { unlink } from 'fs/promises' import { checkFileReceived, uri2local } from '@/common/utils/file' @@ -7,20 +7,24 @@ interface Payload { group_id: number | string content: string image?: string - pinned?: number | string //扩展 - confirm_required?: number | string //扩展 + pinned: number | string //扩展 + confirm_required: number | string //扩展 } export class SendGroupNotice extends BaseAction { actionName = ActionName.GoCQHTTP_SendGroupNotice + payloadSchema = Schema.object({ + group_id: Schema.union([Number, String]).required(), + content: Schema.string().required(), + image: Schema.string(), + pinned: Schema.union([Number, String]).default(0), + confirm_required: Schema.union([Number, String]).default(1) + }) async _handle(payload: Payload) { - if (!payload.content) { - throw new Error('参数 content 不能为空') - } const groupCode = payload.group_id.toString() - const pinned = Number(payload.pinned ?? 0) - const confirmRequired = Number(payload.confirm_required ?? 1) + const pinned = +payload.pinned + const confirmRequired = +payload.confirm_required let picInfo: { id: string, width: number, height: number } | undefined if (payload.image) { diff --git a/src/onebot11/action/group/SendGroupMsg.ts b/src/onebot11/action/group/SendGroupMsg.ts index bd363bf..0004003 100644 --- a/src/onebot11/action/group/SendGroupMsg.ts +++ b/src/onebot11/action/group/SendGroupMsg.ts @@ -6,7 +6,6 @@ class SendGroupMsg extends SendMsg { actionName = ActionName.SendGroupMsg protected _handle(payload: OB11PostSendMsg) { - delete (payload as Partial).user_id payload.message_type = 'group' return super._handle(payload) } diff --git a/src/onebot11/action/msg/SendMsg.ts b/src/onebot11/action/msg/SendMsg.ts index e44e5ae..4fa0d8f 100644 --- a/src/onebot11/action/msg/SendMsg.ts +++ b/src/onebot11/action/msg/SendMsg.ts @@ -1,25 +1,14 @@ -import { - ChatType, - ElementType, - RawMessage, - SendMessageElement, -} from '@/ntqqapi/types' import { OB11MessageCustomMusic, OB11MessageData, OB11MessageDataType, OB11MessageJson, OB11MessageMusic, - OB11MessageNode, OB11PostSendMsg, } from '../../types' -import fs from 'node:fs' import { BaseAction } from '../BaseAction' import { ActionName } from '../types' import { CustomMusicSignPostData, IdMusicSignPostData, MusicSign, MusicSignPostData } from '@/common/utils/sign' -import { Peer } from '@/ntqqapi/types/msg' -import { MessageUnique } from '@/common/utils/messageUnique' -import { selfInfo } from '@/common/globalVars' import { convertMessage2List, createSendElements, sendMsg, createPeer, CreatePeerMode } from '../../helper/createMessage' interface ReturnData { @@ -42,12 +31,7 @@ export class SendMsg extends BaseAction { payload.auto_escape === true || payload.auto_escape === 'true', ) if (this.getSpecialMsgNum(messages, OB11MessageDataType.node)) { - try { - const returnMsg = await this.handleForwardNode(peer, messages as OB11MessageNode[]) - return { message_id: returnMsg.msgShortId! } - } catch (e) { - throw '发送转发消息失败 ' + e - } + throw new Error('请使用 /send_group_forward_msg 或 /send_private_forward_msg 发送合并转发') } else if (this.getSpecialMsgNum(messages, OB11MessageDataType.music)) { const music = messages[0] as OB11MessageMusic @@ -114,140 +98,10 @@ export class SendMsg extends BaseAction { private getSpecialMsgNum(message: OB11MessageData[], msgType: OB11MessageDataType): number { if (Array.isArray(message)) { - return message.filter((msg) => msg.type == msgType).length + return message.filter((msg) => msg.type === msgType).length } return 0 } - - private async cloneMsg(msg: RawMessage): Promise { - this.ctx.logger.info('克隆的目标消息', msg) - const sendElements: SendMessageElement[] = [] - for (const ele of msg.elements) { - sendElements.push(ele as SendMessageElement) - } - if (sendElements.length === 0) { - this.ctx.logger.warn('需要clone的消息无法解析,将会忽略掉', msg) - } - this.ctx.logger.info('克隆消息', sendElements) - try { - const peer = { - chatType: ChatType.friend, - peerUid: selfInfo.uid - } - const nodeMsg = await this.ctx.ntMsgApi.sendMsg(peer, sendElements) - await this.ctx.sleep(400) - return nodeMsg - } catch (e) { - this.ctx.logger.warn(e, '克隆转发消息失败,将忽略本条消息', msg) - } - } - - // 返回一个合并转发的消息id - private async handleForwardNode(destPeer: Peer, messageNodes: OB11MessageNode[]) { - const selfPeer = { - chatType: ChatType.friend, - peerUid: selfInfo.uid, - } - let nodeMsgIds: string[] = [] - // 先判断一遍是不是id和自定义混用 - for (const messageNode of messageNodes) { - // 一个node表示一个人的消息 - const nodeId = messageNode.data.id - // 有nodeId表示一个子转发消息卡片 - if (nodeId) { - const nodeMsg = await MessageUnique.getMsgIdAndPeerByShortId(+nodeId) || await MessageUnique.getPeerByMsgId(nodeId) - if (!nodeMsg) { - this.ctx.logger.warn('转发消息失败,未找到消息', nodeId) - continue - } - nodeMsgIds.push(nodeMsg.MsgId) - } - else { - // 自定义的消息 - // 提取消息段,发给自己生成消息id - try { - const { sendElements, deleteAfterSentFiles } = await createSendElements( - this.ctx, - convertMessage2List(messageNode.data.content), - destPeer - ) - this.ctx.logger.info('开始生成转发节点', sendElements) - const sendElementsSplit: SendMessageElement[][] = [] - let splitIndex = 0 - for (const ele of sendElements) { - if (!sendElementsSplit[splitIndex]) { - sendElementsSplit[splitIndex] = [] - } - - if (ele.elementType === ElementType.FILE || ele.elementType === ElementType.VIDEO) { - if (sendElementsSplit[splitIndex].length > 0) { - splitIndex++ - } - sendElementsSplit[splitIndex] = [ele] - splitIndex++ - } - else { - sendElementsSplit[splitIndex].push(ele) - } - this.ctx.logger.info(sendElementsSplit) - } - // log("分割后的转发节点", sendElementsSplit) - for (const eles of sendElementsSplit) { - const nodeMsg = await sendMsg(this.ctx, selfPeer, eles, []) - if (!nodeMsg) { - this.ctx.logger.warn('转发节点生成失败', eles) - continue - } - nodeMsgIds.push(nodeMsg.msgId) - await this.ctx.sleep(400) - } - deleteAfterSentFiles.map((f) => fs.unlink(f, () => { - })) - } catch (e) { - this.ctx.logger.error('生成转发消息节点失败', e) - } - } - } - - // 检查srcPeer是否一致,不一致则需要克隆成自己的消息, 让所有srcPeer都变成自己的,使其保持一致才能够转发 - const nodeMsgArray: RawMessage[] = [] - let srcPeer: Peer | null = null - let needSendSelf = false - for (const msgId of nodeMsgIds) { - const nodeMsgPeer = await MessageUnique.getPeerByMsgId(msgId) - if (nodeMsgPeer) { - const nodeMsg = (await this.ctx.ntMsgApi.getMsgsByMsgId(nodeMsgPeer.Peer, [msgId])).msgList[0] - srcPeer = srcPeer ?? { chatType: nodeMsg.chatType, peerUid: nodeMsg.peerUid } - if (srcPeer.peerUid !== nodeMsg.peerUid) { - needSendSelf = true - } - nodeMsgArray.push(nodeMsg) - } - } - nodeMsgIds = nodeMsgArray.map((msg) => msg.msgId) - if (needSendSelf) { - for (const msg of nodeMsgArray) { - if (msg.peerUid === selfPeer.peerUid) continue - await this.cloneMsg(msg) - } - } - // elements之间用换行符分隔 - // let _sendForwardElements: SendMessageElement[] = [] - // for(let i = 0; i < sendForwardElements.length; i++){ - // _sendForwardElements.push(sendForwardElements[i]) - // _sendForwardElements.push(SendMsgElementConstructor.text("\n\n")) - // } - // const nodeMsg = await NTQQApi.sendMsg(selfPeer, _sendForwardElements, true); - // nodeIds.push(nodeMsg.msgId) - // await sleep(500); - // 开发转发 - if (nodeMsgIds.length === 0) { - throw Error('转发消息失败,节点为空') - } - const returnMsg = await this.ctx.ntMsgApi.multiForwardMsg(srcPeer!, destPeer, nodeMsgIds) - returnMsg.msgShortId = MessageUnique.createMsg(destPeer, returnMsg.msgId) - return returnMsg - } } export default SendMsg diff --git a/src/onebot11/types.ts b/src/onebot11/types.ts index 91eb137..2e19965 100644 --- a/src/onebot11/types.ts +++ b/src/onebot11/types.ts @@ -308,8 +308,8 @@ export type OB11MessageData = export interface OB11PostSendMsg { message_type?: 'private' | 'group' - user_id: string - group_id?: string + user_id?: string | number + group_id?: string | number message: OB11MessageMixType messages?: OB11MessageMixType // 兼容 go-cqhttp auto_escape?: boolean | string