DefaultOneBotV11Client

class DefaultOneBotV11Client(transport: OneBotV11Transport, json: Json = OneBotV11Json.default) : OneBotV11Client

Default OneBotV11Client implementation backed by a OneBotV11Transport.

Constructors

Link copied to clipboard
constructor(transport: OneBotV11Transport, json: Json = OneBotV11Json.default)

Properties

Link copied to clipboard
open override val events: Flow<OneBotV11Event>

Stream of typed OneBot V11 events decoded from transport incoming payloads.

Link copied to clipboard
open override val isStarted: Boolean

Whether underlying transport lifecycle has started.

Functions

Link copied to clipboard
open suspend override 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
open suspend override fun close()

Releases transport resources.

Link copied to clipboard
open suspend override fun deleteMessage(messageId: Long): ApiResponse<JsonObject>

Calls delete_msg.

Link copied to clipboard
open suspend override fun getLoginInfo(): ApiResponse<LoginInfo>

Calls get_login_info.

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

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

Link copied to clipboard

Calls send_group_msg.

Link copied to clipboard

Calls send_private_msg.

Link copied to clipboard
open suspend override fun start()

Starts lifecycle-managed transport resources.

Link copied to clipboard
open suspend override fun stop()

Stops lifecycle-managed transport resources.

Link copied to clipboard

Creates a OneBotV11Api wrapper from an existing OneBotV11Client.