diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Subscribers.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Subscribers.kt index ee3b613ec..65c5dd0d1 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Subscribers.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Subscribers.kt @@ -60,6 +60,15 @@ fun KClass.subscribeAll(listeners: ListenerBuilder.() -> Unit) ListenerBuilder { this.subscribeInternal(it) }.apply(listeners) } +/** + * 监听一个事件. 可同时进行多种方式的监听 + * @see ListenerBuilder + */ +inline fun subscribeAll(noinline listeners: ListenerBuilder.() -> Unit) { + ListenerBuilder { this.subscribeInternal(it) }.apply(listeners) +} + + /** * 监听构建器. 可同时进行多种方式的监听 * @@ -99,4 +108,4 @@ inline class ListenerBuilder( fun once(block: suspend (E) -> Unit) = handler { block(it); ListeningStatus.STOPPED } -} \ No newline at end of file +}