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:
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 {
|
||||
|
||||
Reference in new issue
Block a user