mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-25 09:37:35 +00:00
refactor(event): use platform in ctx
This commit is contained in:
parent
dd93e1f125
commit
07f282420d
@ -1 +0,0 @@
|
||||
export const PLATFORM = 'chronocat'
|
@ -1 +0,0 @@
|
||||
export const PLATFORM = 'chronocat'
|
@ -7,7 +7,6 @@ import type {
|
||||
SatoriDispatchMessage,
|
||||
} from '@chronocat/shell'
|
||||
import type { O } from 'ts-toolbelt'
|
||||
import { PLATFORM } from './consts'
|
||||
import { buildParser } from './parser'
|
||||
|
||||
export class MessageCreatedDispatchMessage implements SatoriDispatchMessage {
|
||||
@ -48,7 +47,7 @@ export class FriendRequestDispatchMessage implements SatoriDispatchMessage {
|
||||
type = 'satori' as const
|
||||
|
||||
toSatori = async (
|
||||
_ctx: ChronocatContext,
|
||||
ctx: ChronocatContext,
|
||||
_config: O.Intersect<
|
||||
ChronocatLogCurrentConfig,
|
||||
ChronocatSatoriEventsConfig
|
||||
@ -58,7 +57,7 @@ export class FriendRequestDispatchMessage implements SatoriDispatchMessage {
|
||||
id: undefined as unknown as number,
|
||||
type: 'friend-request',
|
||||
|
||||
platform: PLATFORM,
|
||||
platform: ctx.chronocat.platform,
|
||||
self_id: undefined as unknown as string,
|
||||
timestamp: Number(this.buddyReq.reqTime) * 1000,
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import type {
|
||||
import h from '@satorijs/element'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import type { O } from 'ts-toolbelt'
|
||||
import { PLATFORM } from '../consts'
|
||||
import { parseMsgTypes } from './msgt'
|
||||
|
||||
export const buildParser =
|
||||
@ -480,7 +479,7 @@ async function parseElements(
|
||||
switch (m.faceElement!.faceType) {
|
||||
case FaceType.PCPoke: {
|
||||
elements.push(
|
||||
h(`${PLATFORM}:pcpoke`, {
|
||||
h(`${ctx.chronocat.platform}:pcpoke`, {
|
||||
id: m.faceElement!.pokeType,
|
||||
}),
|
||||
)
|
||||
@ -490,10 +489,10 @@ async function parseElements(
|
||||
case FaceType.Normal:
|
||||
case FaceType.Super: {
|
||||
elements.push(
|
||||
h(`${PLATFORM}:face`, {
|
||||
h(`${ctx.chronocat.platform}:face`, {
|
||||
id: m.faceElement!.faceIndex,
|
||||
name: `[${(await ctx.chronocat.api['chronocat.internal.qface.get'](`${m.faceElement!.faceIndex}`))!.QDes.slice(1)}]`,
|
||||
platform: PLATFORM,
|
||||
platform: ctx.chronocat.platform,
|
||||
'unsafe-super': m.faceElement!.faceType === FaceType.Super,
|
||||
'unsafe-result-id': m.faceElement!.resultId,
|
||||
'unsafe-chain-count': m.faceElement!.chainCount,
|
||||
|
Loading…
Reference in New Issue
Block a user