请求兼容Mirai的序列化方法
Closed this issue · 0 comments
尝试使用最新版本
Lagrange.OneBot(Nightly Release 240408版本)、Overflow(2.16.0-febc5da)、MiraiCP(2.16.0)
MiraiCP
MiraiCP-template
当收到消息时报错如后附。
可能需要Mirai的序列化方法以兼容如MiraiCP的更多插件?
谢谢!
2024-04-12 21:10:08 E/MiraiCP: Exception in coroutine Plugin tech.eritquearcus.miraicp of MiraiCP kotlinx.serialization.SerializationException: Class 'class top.mrxiaom.overflow.internal.message.data.IncomingSource$group$1' is not registered for polymorphic serialization in the scope of 'SingleMessage'. To be registered automatically, class 'class top.mrxiaom.overflow.internal.message.data.IncomingSource$group$1' has to be '@Serializable', and the base class 'SingleMessage' has to be sealed and '@Serializable'. Alternatively, register the serializer for 'class top.mrxiaom.overflow.internal.message.data.IncomingSource$group$1' explicitly in a corresponding SerializersModule. at kotlinx.serialization.internal.AbstractPolymorphicSerializerKt.throwSubtypeNotRegistered(AbstractPolymorphicSerializer.kt:102) at kotlinx.serialization.internal.AbstractPolymorphicSerializerKt.throwSubtypeNotRegistered(AbstractPolymorphicSerializer.kt:114) at kotlinx.serialization.PolymorphicSerializerKt.findPolymorphicSerializer(PolymorphicSerializer.kt:109) at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:233) at kotlinx.serialization.encoding.AbstractEncoder.encodeSerializableElement(AbstractEncoder.kt:80) at kotlinx.serialization.internal.CollectionLikeSerializer.serialize(CollectionSerializers.kt:69) at net.mamoe.mirai.message.data.MessageChain$Serializer.serialize(MessageChain.kt:278) at net.mamoe.mirai.message.data.MessageChain$Serializer.serialize(MessageChain.kt:273) at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:228) at kotlinx.serialization.json.internal.JsonStreamsKt.encodeByWriter(JsonStreams.kt:28) at kotlinx.serialization.json.Json.encodeToString(Json.kt:81) at net.mamoe.mirai.message.data.MessageChain$Companion.serializeToJsonString(MessageChain.kt:330) at net.mamoe.mirai.message.data.MessageChain$Companion.serializeToJsonString$default(MessageChain.kt:328) at MiraiCP-plugin-2.16.0.mirai2.jar//tech.eritquearcus.miraicp.shared.Packets$Outgoing$MessageEventData.<init>(Packet.kt:575) at MiraiCP-plugin-2.16.0.mirai2.jar//tech.eritquearcus.miraicp.shared.Packets$Utils.toEventData(Packet.kt:789) at MiraiCP-plugin-2.16.0.mirai2.jar//tech.eritquearcus.miraicp.shared.PublicShared$onEnable$2.invokeSuspend(PublicShared.kt:849) at MiraiCP-plugin-2.16.0.mirai2.jar//tech.eritquearcus.miraicp.shared.PublicShared$onEnable$2.invoke(PublicShared.kt) at MiraiCP-plugin-2.16.0.mirai2.jar//tech.eritquearcus.miraicp.shared.PublicShared$onEnable$2.invoke(PublicShared.kt) at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invokeSuspend(EventChannel.kt:484) at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invoke(EventChannel.kt) at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invoke(EventChannel.kt) at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invokeSuspend(SafeListener.kt:59) at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invoke(SafeListener.kt) at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invoke(SafeListener.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source) at net.mamoe.mirai.internal.event.SafeListener.onEvent(SafeListener.kt:59) at net.mamoe.mirai.internal.event.EventListeners.process(EventListeners.kt:119) at net.mamoe.mirai.internal.event.EventListeners.callListeners$overflow_core(EventListeners.kt:67) at net.mamoe.mirai.internal.event.EventChannelImpl.callListeners(EventChannelImpl.kt:86) at net.mamoe.mirai.internal.event.EventChannelImpl.broadcastEventImpl(EventChannelImpl.kt:76) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl.broadcast$suspendImpl(EventDispatcher.kt:78) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl.broadcast(EventDispatcher.kt) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl$broadcastAsync$job$1.invokeSuspend(EventDispatcher.kt:92) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl$broadcastAsync$job$1.invoke(EventDispatcher.kt) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl$broadcastAsync$job$1.invoke(EventDispatcher.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source) at net.mamoe.mirai.internal.network.components.EventDispatcherImpl.broadcastAsync-kKe4JaQ(EventDispatcher.kt:89) at net.mamoe.mirai.internal.network.components.EventDispatcher$DefaultImpls.broadcastAsync-kKe4JaQ$default(EventDispatcher.kt:24) at top.mrxiaom.overflow.internal.listener.GroupMessageListener.onMessage(group.kt:58) at top.mrxiaom.overflow.internal.listener.GroupMessageListener.onMessage(group.kt:34) at cn.evolvefield.onebot.client.listener.EventListenerKt.message(EventListener.kt:21) at cn.evolvefield.onebot.client.handler.EventBus.onReceive(EventBus.kt:44) at cn.evolvefield.onebot.client.connection.IAdapter$onReceiveMessage$1.invokeSuspend(IAdapter.kt:31) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 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)