Skip to content

Commit

Permalink
feat: 简化ContentTrimEventInterceptorFactory.create实现
Browse files Browse the repository at this point in the history
  • Loading branch information
LightQuanta committed Dec 28, 2024
1 parent fdcb4df commit 66d34de
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
}
}

Expand Down

0 comments on commit 66d34de

Please sign in to comment.