chore: 解耦
This commit is contained in:
1 parent
5eacfae031
commit
419c0f87d1
19 files changed
+667
-667
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OB11ForwardMessage, OB11Message, OB11MessageData } from '../../types';
|
||||
import { OB11Constructor } from '../../helper/data';
|
||||
import { OB11Constructor } from '@/onebot/helper/converter';
|
||||
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',
|
||||
@@ -40,7 +41,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
|
||||
}
|
||||
const msgList = data.msgList;
|
||||
const messages = (await Promise.all(msgList.map(async msg => {
|
||||
const resMsg = await OB11Constructor.message(this.CoreContext, this.OneBotContext, msg);
|
||||
const resMsg = await RawNTMsg2Onebot(this.CoreContext, this.OneBotContext, msg);
|
||||
if (!resMsg) return;
|
||||
resMsg.message_id = MessageUnique.createMsg({
|
||||
guildId: '',
|
||||
|
||||
@@ -2,9 +2,10 @@ import BaseAction from '../BaseAction';
|
||||
import { OB11Message } from '../../types';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType, RawMessage } from '@/core/entities';
|
||||
import { OB11Constructor } from '../../helper/data';
|
||||
import { OB11Constructor } from '@/onebot/helper/converter';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||
import { RawNTMsg2Onebot } from '@/onebot/helper';
|
||||
|
||||
interface Response {
|
||||
messages: OB11Message[];
|
||||
@@ -53,7 +54,7 @@ export default class GetFriendMsgHistory extends BaseAction<Payload, Response> {
|
||||
msg.id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId);
|
||||
}));
|
||||
//转换消息
|
||||
const ob11MsgList = (await Promise.all(msgList.map(msg => OB11Constructor.message(this.CoreContext, this.OneBotContext, msg)))).filter(msg => !!msg);
|
||||
const ob11MsgList = (await Promise.all(msgList.map(msg => RawNTMsg2Onebot(this.CoreContext, this.OneBotContext, msg)))).filter(msg => !!msg);
|
||||
return { 'messages': ob11MsgList };
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,10 @@ import BaseAction from '../BaseAction';
|
||||
import { OB11Message } from '../../types';
|
||||
import { ActionName } from '../types';
|
||||
import { ChatType, Peer, RawMessage } from '@/core/entities';
|
||||
import { OB11Constructor } from '../../helper/data';
|
||||
import { OB11Constructor } from '@/onebot/helper/converter';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||
import { RawNTMsg2Onebot } from '@/onebot/helper';
|
||||
|
||||
interface Response {
|
||||
messages: OB11Message[];
|
||||
@@ -48,7 +49,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Resp
|
||||
}));
|
||||
|
||||
//转换消息
|
||||
const ob11MsgList = (await Promise.all(msgList.map(msg => OB11Constructor.message(this.CoreContext, this.OneBotContext, msg)))).filter(msg => !!msg);
|
||||
const ob11MsgList = (await Promise.all(msgList.map(msg => RawNTMsg2Onebot(this.CoreContext, this.OneBotContext, msg)))).filter(msg => !!msg);
|
||||
return { 'messages': ob11MsgList };
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { OB11User, OB11UserSex } from '../../types';
|
||||
import { OB11Constructor } from '../../helper/data';
|
||||
import { OB11Constructor } from '@/onebot/helper/converter';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { calcQQLevel } from '@/common/utils/helper';
|
||||
|
||||
Reference in new issue
Block a user