mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: baseEmoji Service
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
|||||||
GroupFileExtra
|
GroupFileExtra
|
||||||
} from "@/core/packet/transformer/proto";
|
} from "@/core/packet/transformer/proto";
|
||||||
import {
|
import {
|
||||||
|
BaseEmojiType,
|
||||||
NTMsgAtType,
|
NTMsgAtType,
|
||||||
PicType,
|
PicType,
|
||||||
SendArkElement,
|
SendArkElement,
|
||||||
@@ -162,7 +163,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
constructor(element: SendFaceElement) {
|
constructor(element: SendFaceElement) {
|
||||||
super(element);
|
super(element);
|
||||||
this.faceId = element.faceElement.faceIndex;
|
this.faceId = element.faceElement.faceIndex;
|
||||||
this.isLargeFace = element.faceElement.faceType === 3;
|
this.isLargeFace = element.faceElement.faceType === BaseEmojiType.CHAIN_SUPER_EMOJI;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
|
17
src/core/services/NodeIKernelBaseEmojiService.ts
Normal file
17
src/core/services/NodeIKernelBaseEmojiService.ts
Normal 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;
|
||||||
|
}
|
@@ -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'>;
|
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ export interface TextElement {
|
|||||||
|
|
||||||
export interface FaceElement {
|
export interface FaceElement {
|
||||||
faceIndex: number;
|
faceIndex: number;
|
||||||
faceType: FaceType;
|
faceType: BaseEmojiType;
|
||||||
faceText?: string;
|
faceText?: string;
|
||||||
packId?: string;
|
packId?: string;
|
||||||
stickerId?: string;
|
stickerId?: string;
|
||||||
@@ -253,7 +254,7 @@ export interface FaceBubbleElement {
|
|||||||
faceFlag: number;
|
faceFlag: number;
|
||||||
content: string;
|
content: string;
|
||||||
oldVersionStr: string;
|
oldVersionStr: string;
|
||||||
faceType: number;
|
faceType: BaseEmojiType;
|
||||||
others: string;
|
others: string;
|
||||||
yellowFaceInfo: {
|
yellowFaceInfo: {
|
||||||
index: number;
|
index: number;
|
||||||
|
59
src/core/types/emoji.ts
Normal file
59
src/core/types/emoji.ts
Normal 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;
|
||||||
|
}
|
@@ -8,4 +8,5 @@ export * from './webapi';
|
|||||||
export * from './sign';
|
export * from './sign';
|
||||||
export * from './element';
|
export * from './element';
|
||||||
export * from './constant';
|
export * from './constant';
|
||||||
export * from './graytip';
|
export * from './graytip';
|
||||||
|
export * from './emoji';
|
@@ -264,18 +264,6 @@ export enum NTGrayTipElementSubTypeV2 {
|
|||||||
GRAYTIP_ELEMENT_SUBTYPE_XMLMSG = 12,
|
GRAYTIP_ELEMENT_SUBTYPE_XMLMSG = 12,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 表情类型枚举
|
|
||||||
*/
|
|
||||||
export enum FaceType {
|
|
||||||
Unknown = 0,
|
|
||||||
OldFace = 1, // 老表情
|
|
||||||
Normal = 2, // 常规表情
|
|
||||||
AniSticke = 3, // 动画贴纸
|
|
||||||
Lottie = 4,// 新格式表情
|
|
||||||
Poke = 5 // 可变Poke
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poke 类型枚举
|
* Poke 类型枚举
|
||||||
*/
|
*/
|
||||||
|
@@ -7,7 +7,6 @@ import {
|
|||||||
CustomMusicSignPostData,
|
CustomMusicSignPostData,
|
||||||
ElementType,
|
ElementType,
|
||||||
FaceIndex,
|
FaceIndex,
|
||||||
FaceType,
|
|
||||||
IdMusicSignPostData,
|
IdMusicSignPostData,
|
||||||
MessageElement,
|
MessageElement,
|
||||||
NapCatCore,
|
NapCatCore,
|
||||||
@@ -16,6 +15,7 @@ import {
|
|||||||
RawMessage,
|
RawMessage,
|
||||||
SendMessageElement,
|
SendMessageElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
|
BaseEmojiType,
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import faceConfig from '@/core/external/face_config.json';
|
import faceConfig from '@/core/external/face_config.json';
|
||||||
import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot';
|
import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot';
|
||||||
@@ -547,7 +547,7 @@ export class OneBotMsgApi {
|
|||||||
elementId: '',
|
elementId: '',
|
||||||
faceElement: {
|
faceElement: {
|
||||||
faceIndex: FaceIndex.DICE,
|
faceIndex: FaceIndex.DICE,
|
||||||
faceType: FaceType.AniSticke,
|
faceType: BaseEmojiType.CHAIN_SUPER_EMOJI,
|
||||||
faceText: '[骰子]',
|
faceText: '[骰子]',
|
||||||
packId: '1',
|
packId: '1',
|
||||||
stickerId: '33',
|
stickerId: '33',
|
||||||
@@ -564,7 +564,7 @@ export class OneBotMsgApi {
|
|||||||
faceElement: {
|
faceElement: {
|
||||||
faceIndex: FaceIndex.RPS,
|
faceIndex: FaceIndex.RPS,
|
||||||
faceText: '[包剪锤]',
|
faceText: '[包剪锤]',
|
||||||
faceType: 3,
|
faceType: BaseEmojiType.CHAIN_SUPER_EMOJI,
|
||||||
packId: '1',
|
packId: '1',
|
||||||
stickerId: '34',
|
stickerId: '34',
|
||||||
sourceType: 1,
|
sourceType: 1,
|
||||||
|
Reference in New Issue
Block a user