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:
2 files changed
+10
-3
No files matched your search
@@ -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 },
|
||||
|
||||
Reference in new issue
Block a user