feat: baseEmoji Service

This commit is contained in:
手瓜一十雪
2024-11-22 20:50:51 +08:00
parent 9e94d98cfb
commit 8353d53589
7 changed files with 87 additions and 20 deletions

View File

@@ -14,6 +14,7 @@ import {
GroupFileExtra
} from "@/core/packet/transformer/proto";
import {
BaseEmojiType,
NTMsgAtType,
PicType,
SendArkElement,
@@ -162,7 +163,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
constructor(element: SendFaceElement) {
super(element);
this.faceId = element.faceElement.faceIndex;
this.isLargeFace = element.faceElement.faceType === 3;
this.isLargeFace = element.faceElement.faceType === BaseEmojiType.CHAIN_SUPER_EMOJI;
}
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {

View File

@@ -0,0 +1,17 @@
import { DownloadBaseEmojiByIdReq, DownloadBaseEmojiByUrlReq, GetBaseEmojiPathReq, PullSysEmojisReq } from '../types';
export interface NodeIKernelBaseEmojiService {
removeKernelBaseEmojiListener(listenerId: number): void;
addKernelBaseEmojiListener(listener: unknown): number;
isBaseEmojiPathExist(args: Array<string>): unknown;
fetchFullSysEmojis(pullSysEmojisReq: PullSysEmojisReq): unknown;
getBaseEmojiPathByIds(getBaseEmojiPathReqs: Array<GetBaseEmojiPathReq>): unknown;
downloadBaseEmojiByIdWithUrl(downloadBaseEmojiByUrlReq: DownloadBaseEmojiByUrlReq): unknown;
downloadBaseEmojiById(downloadBaseEmojiByIdReq: DownloadBaseEmojiByIdReq): unknown;
}

View File

@@ -1,4 +1,5 @@
import { ElementType, FaceType, MessageElement, NTGrayTipElementSubTypeV2, PicSubType, PicType, TipAioOpGrayTipElement, TipGroupElement, NTVideoType } from "./msg";
import { BaseEmojiType } from "./emoji";
import { ElementType, MessageElement, NTGrayTipElementSubTypeV2, PicSubType, PicType, TipAioOpGrayTipElement, TipGroupElement, NTVideoType } from "./msg";
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
@@ -30,7 +31,7 @@ export interface TextElement {
export interface FaceElement {
faceIndex: number;
faceType: FaceType;
faceType: BaseEmojiType;
faceText?: string;
packId?: string;
stickerId?: string;
@@ -253,7 +254,7 @@ export interface FaceBubbleElement {
faceFlag: number;
content: string;
oldVersionStr: string;
faceType: number;
faceType: BaseEmojiType;
others: string;
yellowFaceInfo: {
index: number;

59
src/core/types/emoji.ts Normal file
View File

@@ -0,0 +1,59 @@
export enum PullMomentType {
REINSTALL = 0,
RESTART_FIRST_AIO = 1,
LOGIN_APP = 2,
SINGEL_PULL_NOTIFY = 3,
TRIGGER_SPECIFIC_EMOJI_RANDOM_RESULT = 4
}
export interface PullSysEmojisReq {
fetchAdvaceSource: boolean;
fetchBaseSource: boolean;
pullMoment: PullMomentType;
pullType: number;
refresh: boolean;
thresholdValue: number;
}
export enum BaseEmojiType {
NORMAL_EMOJI = 0,
SUPER_EMOJI = 1,
RANDOM_SUPER_EMOJI = 2,
CHAIN_SUPER_EMOJI = 3,
EMOJI_EMOJI = 4
}
export interface GetBaseEmojiPathReq {
emojiId: string;
type: BaseEmojiType;
}
export enum EmojiPanelCategory {
OTHER_PANEL = 0,
NORMAL_PANEL = 1,
SUPER_PANEL = 2,
RED_HEART_PANEL = 3
}
export interface DownloadBaseEmojiInfo {
baseResDownloadUrl: string;
advancedResDownloadUrl: string;
}
export interface DownloadBaseEmojiByUrlReq {
emojiId: string;
groupName: string;
panelCategory: EmojiPanelCategory;
downloadInfo: DownloadBaseEmojiInfo;
}
// public final class DownloadBaseEmojiByIdReq {
// public String groupName;
// public EmojiPanelCategory panelCategory;
// public String emojiId = "";
// public String qzoneCode = "";
export interface DownloadBaseEmojiByIdReq {
emojiId: string;
groupName: string;
panelCategory: EmojiPanelCategory;
qzoneCode: string;
}

View File

@@ -8,4 +8,5 @@ export * from './webapi';
export * from './sign';
export * from './element';
export * from './constant';
export * from './graytip';
export * from './graytip';
export * from './emoji';

View File

@@ -264,18 +264,6 @@ export enum NTGrayTipElementSubTypeV2 {
GRAYTIP_ELEMENT_SUBTYPE_XMLMSG = 12,
}
/**
* 表情类型枚举
*/
export enum FaceType {
Unknown = 0,
OldFace = 1, // 老表情
Normal = 2, // 常规表情
AniSticke = 3, // 动画贴纸
Lottie = 4,// 新格式表情
Poke = 5 // 可变Poke
}
/**
* Poke 类型枚举
*/

View File

@@ -7,7 +7,6 @@ import {
CustomMusicSignPostData,
ElementType,
FaceIndex,
FaceType,
IdMusicSignPostData,
MessageElement,
NapCatCore,
@@ -16,6 +15,7 @@ import {
RawMessage,
SendMessageElement,
SendTextElement,
BaseEmojiType,
} from '@/core';
import faceConfig from '@/core/external/face_config.json';
import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot';
@@ -547,7 +547,7 @@ export class OneBotMsgApi {
elementId: '',
faceElement: {
faceIndex: FaceIndex.DICE,
faceType: FaceType.AniSticke,
faceType: BaseEmojiType.CHAIN_SUPER_EMOJI,
faceText: '[骰子]',
packId: '1',
stickerId: '33',
@@ -564,7 +564,7 @@ export class OneBotMsgApi {
faceElement: {
faceIndex: FaceIndex.RPS,
faceText: '[包剪锤]',
faceType: 3,
faceType: BaseEmojiType.CHAIN_SUPER_EMOJI,
packId: '1',
stickerId: '34',
sourceType: 1,