feat(sdk): add onBotStatus for account session notices

Let bots subscribe to account up/down without using the operator notification channels.
This commit is contained in:
DrSmoothl committed 2026-09-16 21:20:51 +08:00
1 parent ad36d47cf0
commit 23ebee7f20
3 files changed
+42

No files matched your search

@@ -7,6 +7,7 @@ import {
import { Emitter } from '../emitter';
import {
createEventContext,
isBotStatusEvent,
isGroupMessageEvent,
isMessageEvent,
isMetaEvent,
@@ -41,6 +42,7 @@ import type {
ApiResponse,
JsonObject,
JsonValue,
OneBotBotStatusEvent,
OneBotMessageEvent,
OneBotMetaEvent,
OneBotNoticeEvent,
@@ -179,6 +181,10 @@ export class SnowLumaWebSocketClient extends SnowLumaApiClient {
return this.when(isNoticeEvent, typeOrHandler);
}
onBotStatus(handler: EventHandler<OneBotBotStatusEvent>): () => void {
return this.when(isBotStatusEvent, handler);
}
onRequest(handler: EventHandler<OneBotRequestEvent>): () => void;
onRequest(type: string, handler: EventHandler<OneBotRequestEvent>): () => void;
onRequest(typeOrHandler: string | EventHandler<OneBotRequestEvent>, handler?: EventHandler<OneBotRequestEvent>): () => void {