Add emoji likes list support to message types

Introduces the emojiLikesList property to RawMessage and maps it to the new emoji_likes_list field in OB11Message, which is populated in the GetMsg action. Also updates type definitions for stricter typing and consistency.
This commit is contained in:
手瓜一十雪 2026-01-13 16:43:00 +08:00
parent f3de4d48d3
commit cf69ccdbc9
3 changed files with 31 additions and 20 deletions

View File

@ -181,7 +181,7 @@ export interface MessageElement {
tofuRecordElement?: TofuRecordElement, tofuRecordElement?: TofuRecordElement,
taskTopMsgElement?: TaskTopMsgElement, taskTopMsgElement?: TaskTopMsgElement,
recommendedMsgElement?: RecommendedMsgElement, recommendedMsgElement?: RecommendedMsgElement,
actionBarElement?: ActionBarElement actionBarElement?: ActionBarElement;
} }
/** /**
@ -337,7 +337,7 @@ export interface InlineKeyboardElementRowButton {
*/ */
export interface InlineKeyboardElement { export interface InlineKeyboardElement {
rows: [{ rows: [{
buttons: InlineKeyboardElementRowButton[] buttons: InlineKeyboardElementRowButton[];
}], }],
botAppid: string; botAppid: string;
} }
@ -441,14 +441,14 @@ export interface TipGroupElement {
uid: string; uid: string;
card: string; card: string;
name: string; name: string;
role: NTGroupMemberRole role: NTGroupMemberRole;
}; };
member: { member: {
uid: string uid: string;
card: string; card: string;
name: string; name: string;
role: NTGroupMemberRole role: NTGroupMemberRole;
} };
}; };
} }
@ -498,6 +498,7 @@ export interface RawMessage {
sendStatus?: SendStatusType;// 消息状态 sendStatus?: SendStatusType;// 消息状态
recallTime: string;// 撤回时间,"0" 是没有撤回 recallTime: string;// 撤回时间,"0" 是没有撤回
records: RawMessage[];// 消息记录 records: RawMessage[];// 消息记录
emojiLikesList?: Array<{ emojiId: string; emojiType: string; likesCnt: string; isClicked: string; }>;
elements: MessageElement[];// 消息元素 elements: MessageElement[];// 消息元素
sourceType: MsgSourceType;// 消息来源类型 sourceType: MsgSourceType;// 消息来源类型
isOnlineMsg: boolean;// 是否为在线消息 isOnlineMsg: boolean;// 是否为在线消息
@ -508,9 +509,9 @@ export interface RawMessage {
* *
*/ */
export interface QueryMsgsParams { export interface QueryMsgsParams {
chatInfo: Peer & { privilegeFlag?: number }; chatInfo: Peer & { privilegeFlag?: number; };
// searchFields: number; // searchFields: number;
filterMsgType: Array<{ type: NTMsgType, subType: Array<number> }>; filterMsgType: Array<{ type: NTMsgType, subType: Array<number>; }>;
filterSendersUid: string[]; filterSendersUid: string[];
filterMsgFromTime: string; filterMsgFromTime: string;
filterMsgToTime: string; filterMsgToTime: string;
@ -554,7 +555,7 @@ export interface MsgReqType {
queryOrder: boolean, queryOrder: boolean,
includeSelf: boolean, includeSelf: boolean,
includeDeleteMsg: boolean, includeDeleteMsg: boolean,
extraCnt: number extraCnt: number;
} }
/** /**

View File

@ -35,7 +35,16 @@ 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('消息为空');
msg.emojiLikesList?.map(emoji => {
retMsg.emoji_likes_list.push({
emoji_id: emoji.emojiId,
emoji_type: emoji.emojiType,
likes_cnt: emoji.likesCnt,
});
});
// 烘焙emoji_likes_list 仅此处烘焙
try { try {
retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgId)!; retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgId)!;
retMsg.message_seq = retMsg.message_id; retMsg.message_seq = retMsg.message_id;

View File

@ -31,6 +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生效
} }
// 合并转发消息接口定义 // 合并转发消息接口定义
@ -46,7 +47,7 @@ export interface OB11Return<DataType> {
message: string; message: string;
echo?: unknown; // ws调用api才有此字段 echo?: unknown; // ws调用api才有此字段
wording?: string; // go-cqhttp字段错误信息 wording?: string; // go-cqhttp字段错误信息
stream?: 'stream-action' | 'normal-action' ; // 流式返回标记 stream?: 'stream-action' | 'normal-action'; // 流式返回标记
} }
// 消息数据类型枚举 // 消息数据类型枚举
@ -186,7 +187,7 @@ export interface OB11MessageNode {
name?: string; // compatible with go-cqhttp name?: string; // compatible with go-cqhttp
content: OB11MessageMixType; content: OB11MessageMixType;
source?: string; source?: string;
news?: { text: string }[]; news?: { text: string; }[];
summary?: string; summary?: string;
prompt?: string; prompt?: string;
time?: string; time?: string;
@ -210,13 +211,13 @@ export interface OB11MessageIdMusic {
// 自定义音乐消息接口定义 // 自定义音乐消息接口定义
export interface OB11MessageCustomMusic { export interface OB11MessageCustomMusic {
type: OB11MessageDataType.music; type: OB11MessageDataType.music;
data: Omit<CustomMusicSignPostData, 'singer'> & { content?: string }; data: Omit<CustomMusicSignPostData, 'singer'> & { content?: string; };
} }
// JSON消息接口定义 // JSON消息接口定义
export interface OB11MessageJson { export interface OB11MessageJson {
type: OB11MessageDataType.json; type: OB11MessageDataType.json;
data: { config?: { token: string }, data: string | object }; data: { config?: { token: string; }, data: string | object; };
} }
// 骰子消息接口定义 // 骰子消息接口定义
@ -254,12 +255,12 @@ export interface OB11MessageForward {
// 消息数据类型定义 // 消息数据类型定义
export type OB11MessageData = export type OB11MessageData =
OB11MessageText | OB11MessageText |
OB11MessageFace | OB11MessageMFace | OB11MessageFace | OB11MessageMFace |
OB11MessageAt | OB11MessageReply | OB11MessageAt | OB11MessageReply |
OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo | OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo |
OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson | OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson |
OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward | OB11MessageContext | OB11MessagePoke; OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward | OB11MessageContext | OB11MessagePoke;
// 发送消息接口定义 // 发送消息接口定义
export interface OB11PostSendMsg { export interface OB11PostSendMsg {
@ -270,7 +271,7 @@ export interface OB11PostSendMsg {
messages?: OB11MessageMixType; messages?: OB11MessageMixType;
auto_escape?: boolean | string; auto_escape?: boolean | string;
source?: string; source?: string;
news?: { text: string }[]; news?: { text: string; }[];
summary?: string; summary?: string;
prompt?: string; prompt?: string;
time?: string; time?: string;