fix(onebot): make the event pipeline tables type-check

A handler shared by several event kinds now types as one kind at a
time. The converter table still records which kinds are not converted,
so the compile-time check for dropped converted kinds works.
This commit is contained in:
DrSmoothl committed 2026-08-30 16:14:56 +08:00
1 parent 6cf461ef8f
commit a7d293d79b
2 files changed
+10 -3

No files matched your search

+8 -1
View File
@@ -424,7 +424,14 @@ function handlePttTransResult(
traceEventTerminal(log, event.kind, state, 'internal', 'waiter_notified');
}
const convertOnly: PipelineHandler<EventKind> = convertAndDispatch;
function convertOnly<K extends EventKind>(
ctx: OneBotInstanceContext,
log: Logger,
event: Extract<QQEventVariant, { kind: K }>,
state: EventTraceState,
): Promise<void> {
return convertAndDispatch(ctx, log, event, state);
}
const EVENT_PIPELINE = {
friend_message: { handle: handleFriendMessage },