mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-14 20:30:34 +00:00
Make emoji_likes_list optional in OB11Message
Changed the OB11Message interface to make emoji_likes_list optional and updated GetMsg to initialize emoji_likes_list as an empty array before populating it. This prevents errors when the field is missing and improves type safety.
This commit is contained in:
parent
37ae17b53f
commit
fbccf8be24
@ -35,10 +35,10 @@ class GetMsg extends OneBotAction<Payload, OB11Message> {
|
|||||||
// }
|
// }
|
||||||
if (!msg) throw Error('消息不存在');
|
if (!msg) throw Error('消息不存在');
|
||||||
const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat);
|
const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat);
|
||||||
|
|
||||||
if (!retMsg) throw Error('消息为空');
|
if (!retMsg) throw Error('消息为空');
|
||||||
|
retMsg.emoji_likes_list = [];
|
||||||
msg.emojiLikesList?.map(emoji => {
|
msg.emojiLikesList?.map(emoji => {
|
||||||
retMsg.emoji_likes_list.push({
|
retMsg.emoji_likes_list?.push({
|
||||||
emoji_id: emoji.emojiId,
|
emoji_id: emoji.emojiId,
|
||||||
emoji_type: emoji.emojiType,
|
emoji_type: emoji.emojiType,
|
||||||
likes_cnt: emoji.likesCnt,
|
likes_cnt: emoji.likesCnt,
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export interface OB11Message {
|
|||||||
font: number;
|
font: number;
|
||||||
post_type?: EventType;
|
post_type?: EventType;
|
||||||
raw?: RawMessage;
|
raw?: RawMessage;
|
||||||
emoji_likes_list: Array<{ emoji_id: string; emoji_type: string; likes_cnt: string; }>;// 仅get_msg生效
|
emoji_likes_list?: Array<{ emoji_id: string; emoji_type: string; likes_cnt: string; }>;// 仅get_msg生效
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合并转发消息接口定义
|
// 合并转发消息接口定义
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user