Refactor type handling and improve message parsing

Updated several actions to use more precise type casting and type guards, improving type safety and clarity. Enhanced message parsing logic for forward messages and group/friend message history. Standardized return schemas and error handling for avatar and group portrait actions.
This commit is contained in:
手瓜一十雪
2026-01-25 16:32:36 +08:00
parent e562a57713
commit 20398af648
10 changed files with 67 additions and 38 deletions

View File

@@ -46,7 +46,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends OneBotAction<PayloadType
// 烘焙消息
const ob11MsgList = (await Promise.all(
msgList.map(msg => this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat, payload.parse_mult_msg, payload.disable_get_url, payload.quick_reply)))
).filter(msg => msg !== undefined);
return { messages: ob11MsgList as OB11Message[] };
).filter((msg): msg is OB11Message => msg !== undefined);
return { messages: ob11MsgList };
}
}