feat: support facebubble

This commit is contained in:
Il Harper 2024-04-29 23:21:33 +08:00
parent 94f5f5da00
commit 30229d65aa
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
4 changed files with 81 additions and 6 deletions

View File

@ -290,6 +290,18 @@ export class Messager {
return return
} }
case `${this.ctx.chronocat.platform}:facebubble`: {
this.children.push(
r.faceBubble(
Number(attrs['id']),
Number(attrs['count']),
attrs['name'] as string,
attrs['content'] as string,
),
)
return
}
case 'quote': { case 'quote': {
const [author] = this.ctx.chronocat.h.select(children, 'author') const [author] = this.ctx.chronocat.h.select(children, 'author')

View File

@ -1,4 +1,4 @@
import type { Element, Peer, QFace } from '@chronocat/red' import type { Element, FaceBubbleType, Peer, QFace } from '@chronocat/red'
import { AtType, FaceType } from '@chronocat/red' import { AtType, FaceType } from '@chronocat/red'
import type { ChronocatContext } from '@chronocat/shell' import type { ChronocatContext } from '@chronocat/shell'
import type { O } from 'ts-toolbelt' import type { O } from 'ts-toolbelt'
@ -136,6 +136,24 @@ const b = () => {
}, },
}), }),
faceBubble: (
id: FaceBubbleType,
count?: number,
summary?: string,
content?: string,
): O.Partial<Element, 'deep'> => ({
elementType: 27,
elementId: '',
faceBubbleElement: {
faceType: id,
faceCount: count || 1,
faceSummary: summary || '',
faceFlag: 0,
content: content || `[${summary}]x${count}`,
oldVersionStr: '',
},
}),
pcPoke: (pokeType: number): O.Partial<Element, 'deep'> => ({ pcPoke: (pokeType: number): O.Partial<Element, 'deep'> => ({
elementId: '0', elementId: '0',
elementType: 6, elementType: 6,

View File

@ -580,6 +580,18 @@ async function parseElements(
break break
} }
case 27: {
elements.push(
ctx.chronocat.h(`${ctx.chronocat.platform}:facebubble`, {
id: m.faceBubbleElement!.faceType,
count: m.faceBubbleElement!.faceCount,
name: m.faceBubbleElement!.faceSummary,
content: m.faceBubbleElement!.content,
}),
)
break
}
default: default:
break break
} }

View File

@ -284,11 +284,11 @@ export interface Element {
videoElement?: VideoElement videoElement?: VideoElement
walletElement?: unknown walletElement?: unknown
yoloGameResultElement?: unknown yoloGameResultElement?: unknown
structMsgElement: unknown structMsgElement?: unknown
faceBubbleElement: unknown faceBubbleElement?: FaceBubbleElement
shareLocationElement: unknown shareLocationElement?: unknown
tofuRecordElement: unknown tofuRecordElement?: unknown
taskTopMsgElement: unknown taskTopMsgElement?: unknown
} }
export interface PicElement { export interface PicElement {
@ -400,6 +400,39 @@ export interface QFace {
Input: string[] Input: string[]
} }
export interface FaceBubbleElement {
faceType: FaceBubbleType
faceCount: number
faceSummary: string // '平底锅'
faceFlag: number // 0
content: string // '[平底锅]x1'
oldVersionStr: string // ''
others: unknown
yellowFaceInfo: unknown
}
export enum FaceBubbleType {
/**
*
*/
Liulian = 9,
/**
*
*/
LveLveLve = 10,
/**
*
*/
Pingdiguo = 11,
/**
*
*/
Chaopiao = 12,
}
export interface FileElement { export interface FileElement {
fileMd5: string fileMd5: string
fileName: string fileName: string