simple-robot / simpler-robot

Simple Robot,一个bot风格的Kotlin多平台事件调度框架,异步高效、Java友好!/ A Bot-style Kotlin Multiplatform event scheduling framework, asynchronous and high-performance, java-friendly! 🐱😼😻😸
https://simbot.forte.love
GNU Lesser General Public License v3.0
520 stars 43 forks source link

KOOK组件无法监听 MessageBtnClickEvent #708

Closed axiangcoding closed 1 year ago

axiangcoding commented 1 year ago

版本号

v3.1.0

附加版本

// https://mvnrepository.com/artifact/love.forte.simbot.boot/simboot-core-spring-boot-starter implementation("love.forte.simbot.boot:simboot-core-spring-boot-starter:3.1.0") // https://mvnrepository.com/artifact/love.forte.simbot.component/simbot-component-kook-core implementation("love.forte.simbot.component:simbot-component-kook-core:3.0.0.0-alpha.7-SNAPSHOT")

涉及的编程语言

Java

项目构建工具

Gradle

涉及的组件库

KOOK

问题描述

复现方式

springboot项目,代码如下

  @Listener
  @WithSpan
  public void onKookEvent(MessageBtnClickEvent event) {
      System.out.println(event.toString());
  }

相关日志

love.forte.simbot.event.EventListenerProcessingException: love.forte.simboot.listener.BindException: Parameter(#1) [parameter #1 event of fun com.github.axiangcoding.axbot.app.bot.listener.BotEventListener.onKookEvent(love.forte.simbot.kook.event.system.user.MessageBtnClickEvent!): kotlin.Unit] has no binder.
    at love.forte.simbot.core.event.ListenerInvoker.invoke(SimpleEventListenerManagerImpl.kt:466) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.SimpleEventListenerManagerImpl$doInvoke$2$1$1.invokeSuspend(SimpleEventListenerManagerImpl.kt:312) [simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.SimpleEventListenerManagerImpl$doInvoke$2$1$1.invoke(SimpleEventListenerManagerImpl.kt) [simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.SimpleEventListenerManagerImpl$doInvoke$2$1$1.invoke(SimpleEventListenerManagerImpl.kt) [simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.EventProcessingDirectInterceptEntrance.doIntercept(EventInterceptEntrance.kt:116) [simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.SimpleEventListenerManagerImpl$doInvoke$2.invokeSuspend(SimpleEventListenerManagerImpl.kt:306) [simbot-core-3.1.0.jar:?]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.8.22.jar:1.8.22-release-407(1.8.22)]
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [kotlinx-coroutines-core-jvm-1.6.4.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: love.forte.simboot.listener.BindException: Parameter(#1) [parameter #1 event of fun com.github.axiangcoding.axbot.app.bot.listener.BotEventListener.onKookEvent(love.forte.simbot.kook.event.system.user.MessageBtnClickEvent!): kotlin.Unit] has no binder.
    at love.forte.simboot.core.listener.EmptyBinder$resultProvider$3.invoke-d1pmJ48(KFunctionListenerProcessor.kt:513) ~[simboot-core-3.1.0.jar:?]
    at love.forte.simboot.core.listener.EmptyBinder$resultProvider$3.invoke(KFunctionListenerProcessor.kt:512) ~[simboot-core-3.1.0.jar:?]
    at love.forte.simboot.core.listener.EmptyBinder.arg-gIAlu-s(KFunctionListenerProcessor.kt:518) ~[simboot-core-3.1.0.jar:?]
    at love.forte.simboot.listener.FunctionalBindableEventListener.invokeCall(FunctionalBindableEventListener.kt:105) ~[simboot-api-3.1.0.jar:?]
    at love.forte.simboot.listener.FunctionalBindableEventListener.invoke$suspendImpl(FunctionalBindableEventListener.kt:99) ~[simboot-api-3.1.0.jar:?]
    at love.forte.simboot.listener.FunctionalBindableEventListener.invoke(FunctionalBindableEventListener.kt) ~[simboot-api-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2$1.invokeSuspend(SimpleEventListenerManagerImpl.kt:429) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2$1.invoke(SimpleEventListenerManagerImpl.kt) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2$1.invoke(SimpleEventListenerManagerImpl.kt) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.EventListenerDirectInterceptEntrance.doIntercept(EventInterceptEntrance.kt:165) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.EventListenerDirectInterceptEntrance.doIntercept(EventInterceptEntrance.kt:159) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2.invokeSuspend(SimpleEventListenerManagerImpl.kt:428) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2.invoke(SimpleEventListenerManagerImpl.kt) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner$runner$2.invoke(SimpleEventListenerManagerImpl.kt) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.EventListenerDirectInterceptEntrance.doIntercept(EventInterceptEntrance.kt:165) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.EventListenerDirectInterceptEntrance.doIntercept(EventInterceptEntrance.kt:159) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$AbstractFunctionRunner.runner(SimpleEventListenerManagerImpl.kt:426) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$SuspendFunctionRunner.invoke(SimpleEventListenerManagerImpl.kt:454) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker$SuspendFunctionRunner.invoke(SimpleEventListenerManagerImpl.kt:449) ~[simbot-core-3.1.0.jar:?]
    at love.forte.simbot.core.event.ListenerInvoker.invoke(SimpleEventListenerManagerImpl.kt:460) ~[simbot-core-3.1.0.jar:?]
    ... 10 more

其他补充

No response

axiangcoding commented 1 year ago

这样监听也不行

public void onKookEvent(UnsupportedKookEvent event) {
    log.warn("收到未支持的Kook事件: {}", event.getSourceEvent().getAuthorId());
    System.out.println(event.getSourceEvent().getContent());
}
ForteScarlet commented 1 year ago

https://github.com/simple-robot/simbot-component-kook/pull/102 合并后刷新 v3.0.0.0-alpha.7-SNAPSHOT 的快照并尝试其效果。 如果仍然存在问题,请重新开启此议题

axiangcoding commented 1 year ago

已确认能用

@Listener
@WithSpan
public void onKookEvent(KookMessageBtnClickEvent event) {

}