asyncFromEvent |
异步监听这个事件, 并尝试从这个事件中获取一个值. fun <E : Event, R : Any> CoroutineScope.asyncFromEvent(timeoutMillis: Long = -1, coroutineContext: CoroutineContext = EmptyCoroutineContext, mapper: suspend E.(E) -> R?): Deferred<R> |
asyncFromEventOrNull |
异步监听这个事件, 并尝试从这个事件中获取一个值. fun <E : Event, R : Any> CoroutineScope.asyncFromEventOrNull(timeoutMillis: Long, coroutineContext: CoroutineContext = EmptyCoroutineContext, mapper: suspend E.(E) -> R?): Deferred<R?> |
incoming |
打开一个指定事件的接收通道 fun <E : Event> CoroutineScope.incoming(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrencyKind: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, capacity: Int = Channel.UNLIMITED): ReceiveChannel<E> |
subscribe |
在指定的 CoroutineScope 下订阅所有 E 及其子类事件. 每当 事件广播 时, handler 都会被执行. fun <E : Event> CoroutineScope.subscribe(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.LOCKED, handler: suspend E.(E) -> ListeningStatus): Listener<E> fun <E : Event> CoroutineScope.subscribe(eventClass: KClass<E>, coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.LOCKED, handler: suspend E.(E) -> ListeningStatus): Listener<E> |
subscribeAlways |
在指定的 CoroutineScope 下订阅所有 E 及其子类事件. 每当 事件广播 时, listener 都会被执行. fun <E : Event> CoroutineScope.subscribeAlways(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.LOCKED, listener: suspend E.(E) -> Unit): Listener<E> fun <E : Event> CoroutineScope.subscribeAlways(eventClass: KClass<E>, coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrency: ConcurrencyKind = Listener.ConcurrencyKind.LOCKED, listener: suspend E.(E) -> Unit): Listener<E> |
subscribeFriendMessages |
订阅来自所有 Bot 的所有好友消息事件 fun <R> CoroutineScope.subscribeFriendMessages(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrencyKind: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, listeners: FriendMessageSubscribersBuilder.() -> R): R |
subscribeGroupMessages |
订阅来自所有 Bot 的所有群消息事件 fun <R> CoroutineScope.subscribeGroupMessages(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrencyKind: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, listeners: GroupMessageSubscribersBuilder.() -> R): R |
subscribeMessages |
订阅来自所有 Bot 的所有联系人的消息事件. 联系人可以是任意群或任意好友或临时会话. fun <R> CoroutineScope.subscribeMessages(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrencyKind: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, listeners: MessagePacketSubscribersBuilder.() -> R): R |
subscribeOnce |
在指定的 CoroutineScope 下订阅所有 E 及其子类事件. 仅在第一次 事件广播 时, listener 会被执行. fun <E : Event> CoroutineScope.subscribeOnce(coroutineContext: CoroutineContext = EmptyCoroutineContext, listener: suspend E.(E) -> Unit): Listener<E> fun <E : Event> CoroutineScope.subscribeOnce(eventClass: KClass<E>, coroutineContext: CoroutineContext = EmptyCoroutineContext, listener: suspend E.(E) -> Unit): Listener<E> |
subscribeTempMessages |
订阅来自所有 Bot 的所有临时会话消息事件 fun <R> CoroutineScope.subscribeTempMessages(coroutineContext: CoroutineContext = EmptyCoroutineContext, concurrencyKind: ConcurrencyKind = Listener.ConcurrencyKind.CONCURRENT, listeners: TempMessageSubscribersBuilder.() -> R): R |