refactor: make parseMessage an instance method

This commit is contained in:
Seijo Cecilia
2024-08-25 10:12:36 +08:00
parent 83d705400a
commit 6992670418
9 changed files with 158 additions and 174 deletions

View File

@@ -1,10 +1,8 @@
import BaseAction from '../BaseAction';
import { OB11ForwardMessage, OB11Message, OB11MessageData } from '../../types';
import { OB11Constructor } from '@/onebot/helper/converter';
import { OB11ForwardMessage, OB11Message, OB11MessageData } from '@/onebot';
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/utils/MessageUnique';
import { RawNTMsg2Onebot } from '@/onebot/helper';
const SchemaData = {
type: 'object',
@@ -41,7 +39,8 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
}
const msgList = data.msgList;
const messages = (await Promise.all(msgList.map(async msg => {
const resMsg = await RawNTMsg2Onebot(this.CoreContext, this.OneBotContext, msg);
const resMsg = await this.OneBotContext.apiContext.MsgApi
.parseMessage(msg);
if (!resMsg) return;
resMsg.message_id = MessageUnique.createMsg({
guildId: '',