feat: add lua triggers

This commit is contained in:
kwaroran
2024-06-29 05:19:39 +09:00
parent 9624781407
commit 95452921fe
5 changed files with 364 additions and 23 deletions

15
src/ts/process/lua.ts Normal file
View File

@@ -0,0 +1,15 @@
import type { LuaEngine } from "wasmoon";
import type { character, groupChat } from "../storage/database";
import { risuChatParser } from "../parser";
export let LuaSafeIds = new Set<string>()
export function registerLuaProcess(engine:LuaEngine, char:character|groupChat) {
engine.global.set('cbs', (code:string) => {
const parsed = risuChatParser(code, {
chara: char,
})
return parsed
})
}