From 66d34de5bc135b98749535337cfc3e377ab1f556 Mon Sep 17 00:00:00 2001 From: Light_Quanta <zch22248@foxmail.com> Date: Sat, 28 Dec 2024 08:48:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AE=80=E5=8C=96ContentTrimEventInter?= =?UTF-8?q?ceptorFactory.create=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StandardAnnotationEventInterceptorFactory.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/simbot-quantcat/simbot-quantcat-common/src/commonMain/kotlin/love/forte/simbot/quantcat/common/interceptor/impl/StandardAnnotationEventInterceptorFactory.kt b/simbot-quantcat/simbot-quantcat-common/src/commonMain/kotlin/love/forte/simbot/quantcat/common/interceptor/impl/StandardAnnotationEventInterceptorFactory.kt index ba69c4fdd..8a7f2210c 100644 --- a/simbot-quantcat/simbot-quantcat-common/src/commonMain/kotlin/love/forte/simbot/quantcat/common/interceptor/impl/StandardAnnotationEventInterceptorFactory.kt +++ b/simbot-quantcat/simbot-quantcat-common/src/commonMain/kotlin/love/forte/simbot/quantcat/common/interceptor/impl/StandardAnnotationEventInterceptorFactory.kt @@ -23,9 +23,7 @@ package love.forte.simbot.quantcat.common.interceptor.impl -import love.forte.simbot.common.function.ConfigurerFunction import love.forte.simbot.event.EventInterceptor -import love.forte.simbot.event.EventInterceptorRegistrationProperties import love.forte.simbot.event.EventListenerContext import love.forte.simbot.event.EventResult import love.forte.simbot.quantcat.common.interceptor.AnnotationEventInterceptorFactory @@ -43,13 +41,9 @@ public sealed class StandardAnnotationEventInterceptorFactory : AnnotationEventI */ public data object ContentTrimEventInterceptorFactory : StandardAnnotationEventInterceptorFactory() { override fun create(context: AnnotationEventInterceptorFactory.Context): AnnotationEventInterceptorFactory.Result { - return ResultImpl(context.priority) - } - - private data class ResultImpl(private val priority: Int) : AnnotationEventInterceptorFactory.Result() { - override val interceptor: EventInterceptor = InterceptorImpl - override val configuration: ConfigurerFunction<EventInterceptorRegistrationProperties> = ConfigurerFunction { - priority = this@ResultImpl.priority + return AnnotationEventInterceptorFactory.Result.build { + interceptor(InterceptorImpl) + configuration { priority = context.priority } } }