refactor: type

This commit is contained in:
手瓜一十雪 2024-07-26 15:38:43 +08:00
parent 2b7fcce9b2
commit 045e120854
3 changed files with 177 additions and 115 deletions

View File

@ -55,22 +55,24 @@ export enum ElementType {
TASKTOPMSG = 29, TASKTOPMSG = 29,
RECOMMENDEDMSG = 43, RECOMMENDEDMSG = 43,
ACTIONBAR = 44 ACTIONBAR = 44
}
export interface ActionBarElement {
rows: InlineKeyboardRow[];
botAppid: string;
} }
export interface SendActionBarElement { export interface SendActionBarElement {
elementType: ElementType.ACTIONBAR; elementType: ElementType.ACTIONBAR;
elementId: string; elementId: string;
actionBarElement: { actionBarElement: ActionBarElement;
rows: InlineKeyboardRow[]; }
botAppid: string; export interface RecommendedMsgElement {
} rows: InlineKeyboardRow[];
botAppid: string;
} }
export interface SendRecommendedMsgElement { export interface SendRecommendedMsgElement {
elementType: ElementType.RECOMMENDEDMSG; elementType: ElementType.RECOMMENDEDMSG;
elementId: string; elementId: string;
recommendedMsgElement: { recommendedMsgElement: RecommendedMsgElement;
rows: InlineKeyboardRow[];
botAppid: string;
}
} }
export interface InlineKeyboardButton { export interface InlineKeyboardButton {
id: string; id: string;
@ -93,67 +95,72 @@ export interface TofuElementContent {
color: string; color: string;
tittle: string; tittle: string;
} }
export interface TaskTopMsgElement {
msgTitle: string;
msgSummary: string;
iconUrl: string;
topMsgType: number;
}
export interface SendTaskTopMsgElement { export interface SendTaskTopMsgElement {
elementType: ElementType.TASKTOPMSG; elementType: ElementType.TASKTOPMSG;
elementId: string; elementId: string;
taskTopMsgElement: { taskTopMsgElement: TaskTopMsgElement;
msgTitle: string; }
msgSummary: string; export interface TofuRecordElement {
iconUrl: string; type: number;
topMsgType: number; busiid: string;
} busiuuid: string;
descriptionContent: string;
contentlist: TofuElementContent[],
background: string;
icon: string;
uinlist: string[],
uidlist: string[],
busiExtra: string;
updateTime: string;
dependedmsgid: string;
msgtime: string;
onscreennotify: boolean;
} }
export interface SendTofuRecordElement { export interface SendTofuRecordElement {
elementType: ElementType.TOFURECORD; elementType: ElementType.TOFURECORD;
elementId: string; elementId: string;
tofuRecordElement: { tofuRecordElement: TofuRecordElement;
type: number; }
busiid: string;
busiuuid: string; export interface FaceBubbleElement {
descriptionContent: string; faceCount: number;
contentlist: TofuElementContent[], faceSummary: string;
background: string; faceFlag: number;
icon: string; content: string;
uinlist: string[], oldVersionStr: string;
uidlist: string[], faceType: number;
busiExtra: string; others: string;
updateTime: string; yellowFaceInfo: {
dependedmsgid: string; index: number;
msgtime: string; buf: string;
onscreennotify: boolean; compatibleText: string;
text: string;
} }
} }
export interface SendFaceBubbleElement { export interface SendFaceBubbleElement {
elementType: ElementType.FACEBUBBLE; elementType: ElementType.FACEBUBBLE;
elementId: string; elementId: string;
faceBubbleElement: { faceBubbleElement: FaceBubbleElement;
faceCount: number;
faceSummary: string;
faceFlag: number;
content: string;
oldVersionStr: string;
faceType: number;
others: string;
yellowFaceInfo: {
index: number;
buf: string;
compatibleText: string;
text: string;
}
}
} }
export interface AvRecordElement {
type: number;
time: string;
text: string;
mainType: number;
hasRead: boolean;
extraType: number;
}
export interface SendavRecordElement { export interface SendavRecordElement {
elementType: ElementType.AVRECORD; elementType: ElementType.AVRECORD;
elementId: string; elementId: string;
avRecordElement: { avRecordElement: AvRecordElement;
type: number;
time: string;
text: string;
mainType: number;
hasRead: boolean;
extraType: number;
}
} }
export interface YoloUserInfo { export interface YoloUserInfo {
uid: string; uid: string;
@ -170,37 +177,40 @@ export interface SendInlineKeyboardElement {
} }
} }
export interface YoloGameResultElement {
UserInfo: YoloUserInfo[];
}
export interface SendYoloGameResultElement { export interface SendYoloGameResultElement {
elementType: ElementType.YOLOGAMERESULT; elementType: ElementType.YOLOGAMERESULT;
yoloGameResultElement: { yoloGameResultElement: YoloGameResultElement
UserInfo: YoloUserInfo[]; }
} export interface GiphyElement {
id: string;
isClip: boolean;
width: number;
height: number;
} }
export interface SendGiphyElement { export interface SendGiphyElement {
elementType: ElementType.GIPHY; elementType: ElementType.GIPHY;
elementId: string; elementId: string;
giphyElement: { giphyElement: GiphyElement;
id: string;
isClip: boolean;
width: number;
height: number;
}
} }
export interface SendWalletElement { export interface SendWalletElement {
elementType: ElementType.UNKNOWN;//不做 设置位置 elementType: ElementType.UNKNOWN;//不做 设置位置
elementId: string; elementId: string;
walletElement: {} walletElement: {}
} }
export interface CalendarElement {
summary: string;
msg: string;
expireTimeMs: string;
schemaType: number;
schema: string
}
export interface SendCalendarElement { export interface SendCalendarElement {
elementType: ElementType.CALENDAR; elementType: ElementType.CALENDAR;
elementId: string; elementId: string;
calendarElement: { calendarElement: CalendarElement;
summary: string;
msg: string;
expireTimeMs: string;
schemaType: number;
schema: string
}
} }
export interface SendliveGiftElement { export interface SendliveGiftElement {
elementType: ElementType.LIVEGIFT; elementType: ElementType.LIVEGIFT;
@ -252,32 +262,18 @@ export enum PicSubType {
export interface SendPicElement { export interface SendPicElement {
elementType: ElementType.PIC; elementType: ElementType.PIC;
elementId: string; elementId: string;
picElement: { picElement:PicElement
md5HexStr: string; }
fileSize: number | string; export interface ReplyElement {
picWidth: number; replayMsgSeq: string;
picHeight: number; replayMsgId: string;
fileName: string; senderUin: string;
sourcePath: string; senderUinStr: string;
original: boolean;
picType: PicType;
picSubType: PicSubType;
fileUuid: string;
fileSubId: string;
thumbFileSize: number;
summary: string;
};
} }
export interface SendReplyElement { export interface SendReplyElement {
elementType: ElementType.REPLY; elementType: ElementType.REPLY;
elementId: string; elementId: string;
replyElement: { replyElement: ReplyElement
replayMsgSeq: string;
replayMsgId: string;
senderUin: string;
senderUinStr: string;
}
} }
export interface SendFaceElement { export interface SendFaceElement {
@ -293,10 +289,11 @@ export interface SendMarketFaceElement {
export interface SendstructLongMsgElement { export interface SendstructLongMsgElement {
elementType: ElementType.STRUCTLONGMSG; elementType: ElementType.STRUCTLONGMSG;
elementId: string; elementId: string;
structLongMsgElement: { structLongMsgElement: StructLongMsgElement;
xmlContent: string; }
resId: string; export interface StructLongMsgElement {
} xmlContent: string;
resId: string;
} }
export interface SendactionBarElement { export interface SendactionBarElement {
elementType: ElementType.ACTIONBAR; elementType: ElementType.ACTIONBAR;
@ -306,13 +303,14 @@ export interface SendactionBarElement {
botAppid: string; botAppid: string;
} }
} }
export interface ShareLocationElement {
text: string;
ext: string;
}
export interface sendShareLocationElement { export interface sendShareLocationElement {
elementType: ElementType.SHARELOCATION; elementType: ElementType.SHARELOCATION;
elementId: string; elementId: string;
shareLocationElement: { shareLocationElement?: ShareLocationElement;
text: string;
ext: string;
}
} }
export interface FileElement { export interface FileElement {
@ -356,10 +354,51 @@ export interface SendMarkdownElement {
elementId: string; elementId: string;
markdownElement: MarkdownElement; markdownElement: MarkdownElement;
} }
export type SendMessageElement = SendTextElement | SendPttElement | export type SendMessageElement = SendTextElement | SendPttElement |
SendPicElement | SendReplyElement | SendFaceElement | SendMarketFaceElement | SendFileElement | SendVideoElement | SendArkElement | SendMarkdownElement | sendShareLocationElement SendPicElement | SendReplyElement | SendFaceElement | SendMarketFaceElement | SendFileElement |
SendVideoElement | SendArkElement | SendMarkdownElement | sendShareLocationElement;
export interface TextElement {
content: string;
atType: number;
atUid: string;
atTinyId: string;
atNtUid: string;
}
export interface MessageElement {
elementType: ElementType,
elementId: string,
extBufForUI: string,
textElement?: TextElement;
faceElement?: FaceElement,
marketFaceElement?: MarkdownElement,
replyElement?: ReplyElement,
picElement?: PicElement,
pttElement?: PttElement,
videoElement?: VideoElement,
grayTipElement?: GrayTipElement,
arkElement?: ArkElement,
fileElement?: FileElement,
liveGiftElement?: null,
markdownElement?: MarkdownElement,
structLongMsgElement?: StructLongMsgElement,
multiForwardMsgElement?: MultiForwardMsgElement,
giphyElement?: GiphyElement,
walletElement?: null,
inlineKeyboardElement?: InlineKeyboardElement,
textGiftElement?: null,//????
calendarElement?: CalendarElement,
yoloGameResultElement?: YoloGameResultElement,
avRecordElement?: AvRecordElement,
structMsgElement?: null,
faceBubbleElement?: FaceBubbleElement,
shareLocationElement: ShareLocationElement,
tofuRecordElement?: TofuRecordElement,
taskTopMsgElement?: TaskTopMsgElement,
recommendedMsgElement?: RecommendedMsgElement,
actionBarElement?:ActionBarElement
}
export enum AtType { export enum AtType {
notAt = 0, notAt = 0,
atAll = 1, atAll = 1,
@ -450,18 +489,23 @@ export const IMAGE_HTTP_HOST = 'https://gchat.qpic.cn';
export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn'; export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn';
export interface PicElement { export interface PicElement {
picSubType?: number; md5HexStr?: string;
originImageUrl: string; // http url, 没有hosthost是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn fileSize: number | string;//number
originImageMd5?: string;
sourcePath: string; // 图片本地路径
thumbPath: Map<number, string>;
picWidth: number; picWidth: number;
picHeight: number; picHeight: number;
fileSize: number;
fileName: string; fileName: string;
sourcePath: string;
original: boolean;
picType: PicType;
picSubType?: PicSubType;
fileUuid: string; fileUuid: string;
md5HexStr?: string; fileSubId: string;
} thumbFileSize: number;
summary: string;
thumbPath: Map<number, string>;
originImageMd5?: string;
originImageUrl?: string; // http url, 没有hosthost是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
};
export enum GrayTipElementSubType { export enum GrayTipElementSubType {
INVITE_NEW_MEMBER = 12, INVITE_NEW_MEMBER = 12,

View File

@ -1,4 +1,4 @@
import { ElementType, Peer, RawMessage, SendMessageElement } from '@/core/entities'; import { ElementType, MessageElement, Peer, RawMessage, SendMessageElement } from '@/core/entities';
import { NodeIKernelMsgListener } from '@/core/listeners/NodeIKernelMsgListener'; import { NodeIKernelMsgListener } from '@/core/listeners/NodeIKernelMsgListener';
import { GeneralCallResult } from '@/core/services/common'; import { GeneralCallResult } from '@/core/services/common';
@ -115,7 +115,7 @@ export interface NodeIKernelMsgService {
addLocalTofuRecordMsg(...args: unknown[]): unknown; addLocalTofuRecordMsg(...args: unknown[]): unknown;
addLocalRecordMsg(Peer: Peer, msgId: string, rawMessage: RawMessage, attr: Array<any> | number, front: boolean): Promise<unknown>; addLocalRecordMsg(Peer: Peer, msgId: string, ele: MessageElement, attr: Array<any> | number, front: boolean): Promise<unknown>;
deleteMsg(...args: unknown[]): unknown; deleteMsg(...args: unknown[]): unknown;

View File

@ -1,4 +1,4 @@
import { GetFileListParam, Peer } from "../entities"; import { GetFileListParam, MessageElement, Peer, SendMessageElement } from "../entities";
import { GeneralCallResult } from "./common"; import { GeneralCallResult } from "./common";
export interface NodeIKernelRichMediaService { export interface NodeIKernelRichMediaService {
@ -46,7 +46,7 @@ export interface NodeIKernelRichMediaService {
} }
}>; }>;
getRichMediaFileDir(arg1: unknown, arg2: unknown, arg3: unknown): unknown; getRichMediaFileDir(elementType: number, downType: number, isTemp: boolean): unknown;
// this.senderUid = ""; // this.senderUid = "";
// this.peerUid = ""; // this.peerUid = "";
@ -65,7 +65,20 @@ export interface NodeIKernelRichMediaService {
// this.elem = msgElement; // this.elem = msgElement;
// this.useHttps = num; // this.useHttps = num;
getVideoPlayUrlInVisit(arg: unknown): unknown; getVideoPlayUrlInVisit(arg: {
downloadType: number,
thumbSize: number,
msgId: string,
msgRandom: string,
msgSeq: string,
msgTime: string,
chatType: number,
senderUid: string,
peerUid: string,
guildId: string,
ele: MessageElement,
useHttps: boolean
}): Promise<unknown>;
isFileExpired(arg: unknown): unknown; isFileExpired(arg: unknown): unknown;
@ -83,7 +96,12 @@ export interface NodeIKernelRichMediaService {
// this.fileSize = j2; // this.fileSize = j2;
// this.fileModelId = j3; // this.fileModelId = j3;
downloadFileForFileUuid(peer: Peer, arg1: string, arg3: unknown[]): unknown; downloadFileForFileUuid(peer: Peer, uuid: string, arg3: {
fileId: string,
fileName: string,
fileSize: string,
fileModelId: string
}[]): unknown;
downloadFileByUrlList(arg1: unknown, arg2: unknown): unknown; downloadFileByUrlList(arg1: unknown, arg2: unknown): unknown;
@ -133,7 +151,7 @@ export interface NodeIKernelRichMediaService {
moveGroupFile(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown, arg5: unknown): unknown; moveGroupFile(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown, arg5: unknown): unknown;
transGroupFile(arg1: unknown, arg2: unknown): unknown; transGroupFile(arg1: unknown, arg2: unknown): unknown;
searchGroupFile( searchGroupFile(
keywords: Array<string>, keywords: Array<string>,
param: { param: {