refactor: AdapterConfig

This commit is contained in:
手瓜一十雪
2024-11-16 18:38:44 +08:00
parent b92ce1f6b5
commit 8223c98bf1
7 changed files with 20 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { MessageUnique } from '@/common/message-unique';
import { RawMessage } from '@/core';
import { AdapterConfigWrap } from '@/onebot/config/config';
export type ReturnDataType = OB11Message
@@ -24,7 +25,7 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
async _handle(payload: Payload, adapter: string) {
// log("history msg ids", Object.keys(msgHistory));
const network = Object.values(this.obContext.configLoader.configData.network) as Array<typeof this.obContext.configLoader.configData.network[keyof typeof this.obContext.configLoader.configData.network]>;
const network = Object.values(this.obContext.configLoader.configData.network) as Array<AdapterConfigWrap>;
const msgFormat = network.flat().find(e => e.name === adapter)?.messagePostFormat ?? 'array';
if (!payload.message_id) {
throw Error('参数message_id不能为空');