nextMessageOrNull

inline suspend fun <P : MessageEvent> P.nextMessageOrNull(timeoutMillis: Long, priority: EventPriority = EventPriority.MONITOR, noinline filter: suspend P.(P) -> Boolean = { true }): MessageChain?

挂起当前协程, 等待下一条 MessageEvent.senderMessageEvent.subjectthis 相同且通过 筛选MessageEvent

filter 抛出了一个异常, 本函数会立即抛出这个异常.

Return

消息链. 超时时返回 null

Parameters

timeoutMillis

超时. 单位为毫秒.

filter

过滤器. 过滤器函数返回 true 表示拦截并返回此 MessageEvent. 返回 false 表示忽略该事件并继续监听下一个事件.

See also