OneBotClient

interface OneBotClient

Core OneBot V12 client abstraction.

It exposes a typed event stream and generic action invocation.

Inheritors

Properties

Link copied to clipboard
abstract val events: Flow<OneBotEvent>

Stream of typed OneBot events decoded from transport incoming payloads.

Link copied to clipboard
abstract val isStarted: Boolean

Whether underlying transport lifecycle has started.

Functions

Link copied to clipboard
abstract suspend fun <T> call(action: String, params: JsonObject, serializer: KSerializer<T>): ApiResponse<T>

Calls a OneBot action and decodes the data field with serializer.

Link copied to clipboard
abstract suspend fun close()

Releases transport resources.

Link copied to clipboard
abstract suspend fun deleteMessage(messageId: String): ApiResponse<JsonObject>

Calls delete_message.

Link copied to clipboard
abstract suspend fun getSelfInfo(): ApiResponse<SelfInfo>

Calls get_self_info.

Link copied to clipboard
fun OneBotClient.listenEventsAnnotated(listener: Any, scope: CoroutineScope, onHandlerError: (Throwable, OneBotEvent) -> Unit = { error, _ -> throw error }): Job

Subscribes to OneBotClient.events and dispatches each event to methods annotated with Event.

Link copied to clipboard

Calls send_message.

Link copied to clipboard
abstract suspend fun start()

Starts lifecycle-managed transport resources.

Link copied to clipboard
abstract suspend fun stop()

Stops lifecycle-managed transport resources.

Link copied to clipboard

Creates a full OneBotV12Api wrapper from an existing OneBotClient.