refactor(shell): satori: dispatch message inject ctx

This commit is contained in:
Il Harper 2024-03-05 19:31:23 +08:00
parent 8478cf4437
commit bb3ce5eaf8
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
3 changed files with 3 additions and 5 deletions

View File

@ -112,8 +112,6 @@ export const chronocat = async () => {
return
}
const authData = await getAuthData()
const log: ChronocatLogCurrentConfig = config.log!
// 预处理 self_url
if (!log.self_url || log.self_url === 'https://chronocat.vercel.app')
@ -124,7 +122,7 @@ export const chronocat = async () => {
// Log satori message
emitter.register(async (m) => {
if (m.type !== 'satori') return
;(await m.toSatori(authData.uin, log)).forEach((e) => l.parse(e))
;(await m.toSatori(ctx, log)).forEach((e) => l.parse(e))
})
emitter.register((await initServers(ctx)).emit)

View File

@ -290,7 +290,7 @@ export const initSatoriServer = async (
// eslint-disable-next-line @typescript-eslint/no-misused-promises
authorizedClients.forEach(async (ws) => {
await message.toSatori(uin, config).then((events) =>
await message.toSatori(cctx, config).then((events) =>
events.forEach((body) =>
ws.send(
JSON.stringify({

View File

@ -19,7 +19,7 @@ export const initSatoriWebHook = async (
void (async () => {
const uin = (await cctx.chronocat.getAuthData()).uin
await message.toSatori(uin, config).then((events) =>
await message.toSatori(cctx, config).then((events) =>
events.forEach((data) => {
const body = {
...data,