@JvmName("subscribeAlwaysForBot1") inline fun <reified E : BotEvent> Bot.subscribeAlways(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, noinline listener: suspend E.(E) -> Unit): Listener<E>
在 Bot 的 CoroutineScope 下订阅所有 E 及其子类事件. 每当 事件广播 时, listener 都会被执行.
可在任意时候通过 Listener.complete 来主动停止监听. Bot 被关闭后事件监听会被 取消.
coroutineContext
- 给事件监听协程的额外的 CoroutineContext
See Also
@SinceMirai("0.38.0") fun <E : BotEvent> Bot.subscribeAlways(eventClass: KClass<E>, coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, listener: suspend E.(E) -> Unit): Listener<E>
See Also