Commit 04da1800 authored by Him188's avatar Him188

Fix `has`

parent 6700d470
...@@ -438,14 +438,14 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>( ...@@ -438,14 +438,14 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
*/ */
@MessageDsl @MessageDsl
inline fun <reified M : Message> has(): ListeningFilter = inline fun <reified M : Message> has(): ListeningFilter =
content { message.any { it::class == M::class } } content { message.any { it is M } }
/** /**
* 如果消息内容包含 [M] 类型的 [Message], 就执行 [onEvent] * 如果消息内容包含 [M] 类型的 [Message], 就执行 [onEvent]
*/ */
@MessageDsl @MessageDsl
inline fun <reified M : Message> has(crossinline onEvent: MessageListener<T>): Listener<T> = inline fun <reified M : Message> has(crossinline onEvent: MessageListener<T>): Listener<T> =
content({ message.any { it::class == M::class } }, onEvent) content({ message.any { it is M } }, onEvent)
/** /**
* 如果 [filter] 返回 `true` * 如果 [filter] 返回 `true`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment