Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

简化ContentTrimEventInterceptorFactory.create的实现 #995

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = [email protected]
return AnnotationEventInterceptorFactory.Result.build {
interceptor(InterceptorImpl)
configuration { priority = context.priority }
}
}

Expand Down
Loading