问题描述
我想对VoiceStateUpdate事件做出反应,但是有时,当成员加入或离开VoiceChannel时,它不会被触发。但是,当我订阅摘要(discord4j.core.event.domain。)Event类时,便触发了该事件:
//absract event class
client.getEventdispatcher().on(Event.class)
//everytime sb leaves/joins it outputs: VoiceStateUpdateEvent{...}
.subscribe(System.out::println);
//specific VoiceStateUpdateEvent class
client.getEventdispatcher().on(VoiceStateUpdateEvent.class)
//just prints out the event as well,but not always
.subscribe(System.out::println);
如果我省略抽象事件订阅,它仍然几乎不会调用特定事件。 在大多数情况下,第一次在漫游器处于联机状态时,两个侦听器都会被触发,此后大部分时间是第一个。我还没有找到一种模式(我试图在加入和离开之间等待一段时间。)是否有任何原因?这已经发生在我身上(将DM发送给机器人时,仅触发了抽象的MessageEvent而不触发了MessageCreateEvent)。提前寻求帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)