fix: adapter api

This commit is contained in:
手瓜一十雪
2024-11-14 20:25:08 +08:00
parent d9a67de683
commit a1b199fcde
4 changed files with 17 additions and 8 deletions

View File

@@ -30,7 +30,9 @@ export class GetGroupEssence extends BaseAction<Payload, any> {
};
}
async _handle(payload: Payload) {
async _handle(payload: Payload, adapter: string) {
let network = Object.values(this.obContext.configLoader.configData.network) as Array<typeof this.obContext.configLoader.configData.network[keyof typeof this.obContext.configLoader.configData.network]>;
let msgFormat = network.flat().find(e => e.name === adapter)?.messagePostFormat ?? 'array';
const msglist = (await this.core.apis.WebApi.getGroupEssenceMsgAll(payload.group_id.toString())).flatMap((e) => e.data.msg_list);
if (!msglist) {
throw new Error('获取失败');
@@ -51,7 +53,7 @@ export class GetGroupEssence extends BaseAction<Payload, any> {
operator_nick: msg.add_digest_nick,
message_id: message_id,
operator_time: msg.add_digest_time,
content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage))?.message
content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage, msgFormat))?.message
};
}
const msgTempData = JSON.stringify({