ApplicationBuilder

Application 的构建器.

ApplicationBuilder 中,所有相关的函数如果没做特殊说明的话均为 非线程安全的。 因此请避免并行的使用未作特殊说明的函数。

Parameters

A

目标 Application 类型

Functions

Link copied to clipboard
abstract fun bots(registrar: suspend BotRegistrar.() -> Unit)

提供一个可以使用 BotVerifyInfo 进行通用性bot注册的配置方式。

Link copied to clipboard
abstract fun <C : Component, Config : Any> install(componentFactory: ComponentFactory<C, Config>, configurator: Config.(perceivable: CompletionPerceivable<A>) -> Unit = {})

注册一个 组件.

abstract fun <P : EventProvider, Config : Any> install(eventProviderFactory: EventProviderFactory<P, Config>, configurator: Config.(perceivable: CompletionPerceivable<A>) -> Unit = {})

注册一个事件提供者。

Link copied to clipboard
abstract override fun onCompletion(handle: suspend (application: A) -> Unit)

注册一个当 Application 构建完成后的回调函数。

Extensions

Link copied to clipboard
fun ApplicationBuilder<*>.installAll(classLoader: ClassLoader = this.currentClassLoader)
Link copied to clipboard
fun <A : Application> ApplicationBuilder<A>.installAllComponents(classLoader: ClassLoader = ComponentAutoRegistrarFactory::class.java.classLoader)

尝试加载所有的 ComponentAutoRegistrarFactory 并注册到 ApplicationBuilder 中。

Link copied to clipboard
fun <A : Application> ApplicationBuilder<A>.installAllEventProviders(classLoader: ClassLoader = EventProviderAutoRegistrarFactory::class.java.classLoader)

尝试加载所有的 ComponentAutoRegistrarFactory 并注册到 ApplicationBuilder 中。