mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-09-28 11:48:29 +00:00
refactor(shell): satori: dispatch message inject ctx
This commit is contained in:
parent
8478cf4437
commit
bb3ce5eaf8
@ -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)
|
||||
|
@ -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({
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user