Skip to content

Commit

Permalink
Merge pull request #995 from LightQuanta/v4-dev
Browse files Browse the repository at this point in the history
简化ContentTrimEventInterceptorFactory.create的实现
  • Loading branch information
ForteScarlet authored Dec 28, 2024
2 parents fdcb4df + 66d34de commit d3e1f0e
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 d3e1f0e

Please sign in to comment.