@Component
public class GroupAnnouncement extends SimpleListenerHost {
@NotNull
@EventHandler
public void onMessage(@NotNull GroupMessageEvent event) throws Exception { // 可以抛出任何异常, 将在 handleException 处理
OnlineAnnouncement onlineAnnouncement = event.getGroup().getAnnouncements().get("ac8194330000000001faf663a1c80e00");
System.out.println(onlineAnnouncement);
List members = onlineAnnouncement.members(false);
System.out.println(members);
}
}
mirai-core 版本
2.15.0-dev-21
bot-protocol
ANDROID_PAD
其他组件版本
No response
系统日志
2023-03-09 16:08:47 E/Bot 3582114840: java.lang.IllegalStateException: Exception while broadcasting event 'GroupMessageEvent'
java.lang.IllegalStateException: Exception while broadcasting event 'GroupMessageEvent'
at net.mamoe.mirai.internal.network.components.EventDispatcherImpl.broadcast$suspendImpl(EventDispatcher.kt:104)
at net.mamoe.mirai.internal.network.components.EventDispatcherImpl$broadcast$1.invokeSuspend(EventDispatcher.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:233)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.lang.IllegalStateException: 未找到异常处理器. 请继承 SimpleListenerHost 中的 handleException 方法, 或在构造 SimpleListenerHost 时提供 CoroutineExceptionHandler
------------
Cannot find exception handler from coroutineContext.
Please extend SimpleListenerHost.handleException or provide a CoroutineExceptionHandler to the constructor of SimpleListenerHost
at net.mamoe.mirai.event.SimpleListenerHost.handleException(JvmMethodListeners.kt:192)
at net.mamoe.mirai.event.SimpleListenerHost$special$$inlined$CoroutineExceptionHandler$1.handleException(CoroutineExceptionHandler.kt:111)
at net.mamoe.mirai.internal.event.SafeListener.onEvent(SafeListener.kt:75)
at net.mamoe.mirai.internal.event.SafeListener$onEvent$1.invokeSuspend(SafeListener.kt)
... 9 more
Caused by: net.mamoe.mirai.event.ExceptionInEventHandlerException: Exception in EventHandler
at net.mamoe.mirai.internal.event.JvmMethodListenersInternalKt.registerEventHandler$callMethod$invokeWithErrorReport(JvmMethodListenersInternal.kt:147)
at net.mamoe.mirai.internal.event.JvmMethodListenersInternalKt.access$registerEventHandler$callMethod$invokeWithErrorReport(JvmMethodListenersInternal.kt:1)
at net.mamoe.mirai.internal.event.JvmMethodListenersInternalKt$registerEventHandler$callMethod$2.invokeSuspend(JvmMethodListenersInternal.kt:154)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at net.mamoe.mirai.internal.event.JvmMethodListenersInternalKt.registerEventHandler$callMethod$invokeWithErrorReport(JvmMethodListenersInternal.kt:140)
... 10 more
Caused by: net.mamoe.mirai.contact.PermissionDeniedException: Only administrator have permission see announcement confirmed detail
at net.mamoe.mirai.internal.contact.announcement.CommonAnnouncementsImpl.members$suspendImpl(AnnouncementsImpl.kt:150)
at net.mamoe.mirai.internal.contact.announcement.CommonAnnouncementsImpl.members(AnnouncementsImpl.kt)
at net.mamoe.mirai.contact.announcement.OnlineAnnouncement.members$suspendImpl(OnlineAnnouncement.kt:92)
at net.mamoe.mirai.contact.announcement.OnlineAnnouncement.members(OnlineAnnouncement.kt)
at net.mamoe.mirai.contact.announcement.OnlineAnnouncement$members$2.invoke(OnlineAnnouncement.kt)
at net.mamoe.mirai.contact.announcement.OnlineAnnouncement$members$2.invoke(OnlineAnnouncement.kt)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:205)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
at me.him188.kotlin.jvm.blocking.bridge.internal.RunSuspendKt.$runSuspend$(RunSuspend.kt:18)
at net.mamoe.mirai.contact.announcement.OnlineAnnouncement.members(OnlineAnnouncement.kt)
at com.jumpjump.event.GroupAnnouncement.onMessage(GroupAnnouncement.java:24)
... 15 mor
问题描述
在使用dev-21版本的时候 获取哪些人看了公告报错
复现
@Component public class GroupAnnouncement extends SimpleListenerHost { @NotNull @EventHandler public void onMessage(@NotNull GroupMessageEvent event) throws Exception { // 可以抛出任何异常, 将在 handleException 处理 OnlineAnnouncement onlineAnnouncement = event.getGroup().getAnnouncements().get("ac8194330000000001faf663a1c80e00"); System.out.println(onlineAnnouncement); List members = onlineAnnouncement.members(false);
System.out.println(members);
}
}
mirai-core 版本
2.15.0-dev-21
bot-protocol
ANDROID_PAD
其他组件版本
No response
系统日志
网络日志
No response
补充信息
No response