feat(shell): inject h & styles

This commit is contained in:
Il Harper 2024-03-06 10:40:54 +08:00
parent c983cb77ba
commit e2c201c8c4
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import h from '@satorijs/element'
import styles from 'ansi-styles'
import { mkdirSync, readdirSync } from 'node:fs'
import { join } from 'node:path'
@ -40,9 +41,11 @@ export const chronocat = async () => {
getAuthData,
getConfig,
getSelfProfile,
h,
l,
platform: PLATFORM,
sleep,
styles,
timeout,
uix,
validate,

View File

@ -1,4 +1,6 @@
import type { QFace } from '@chronocat/red'
import type h from '@satorijs/element'
import type styles from 'ansi-styles'
import type { O } from 'ts-toolbelt'
import type { Event, Message, MessageCreatePayload } from './satori/types'
import type { api } from './services/api'
@ -26,9 +28,11 @@ export interface ChronocatContext {
getAuthData: typeof getAuthData
getConfig: typeof getConfig
getSelfProfile: typeof getSelfProfile
h: typeof h
l: typeof l
platform: typeof PLATFORM
sleep: typeof sleep
styles: typeof styles
timeout: typeof timeout
uix: typeof uix
validate: typeof validate
@ -68,7 +72,13 @@ export interface Methods {
// Internal
'chronocat.internal.message.create.forward': [
[MessageCreatePayload],
Message[],
]
'chronocat.internal.assets.get': [[string], string]
'chronocat.internal.qface.get': [[string], QFace | undefined]
'chronocat.internal.qface.list': [[], QFace[] | undefined]
}