Skip to content

telegramBot的member序列化问题 #891

@Flock-YT

Description

@Flock-YT

是否会提供贡献?

版本号

simpler-robot:v4.3.0

附加版本

simbot-component-telegram:v0.0.9

涉及的编程语言

Java

项目构建工具

Maven

涉及的组件库

Telegram

问题描述

2024-07-24T19:32:50.432+08:00 ERROR 16428 --- [Eric_TGADHBot] [tcher-worker-10] l.f.simbot.telegram.stdlib.bot.event     : Handle an error on long polling task: Serializer for subclass 'member' is not found in the polymorphic scope of 'ChatMember'.
Check if class with serial name 'member' exists and serializer is registered in a corresponding SerializersModule.
To be registered automatically, class 'member' has to be '@Serializable', and the base class 'ChatMember' has to be sealed and '@Serializable'.
JSON input: `{"user":{"id":******,"is_bot":true,"first_name":"***Bot","username":"******"},"status":"member"}`

kotlinx.serialization.json.internal.JsonDecodingException: Serializer for subclass 'member' is not found in the polymorphic scope of 'ChatMember'.
Check if class with serial name 'member' exists and serializer is registered in a corresponding SerializersModule.
To be registered automatically, class 'member' has to be '@Serializable', and the base class 'ChatMember' has to be sealed and '@Serializable'.
JSON input: {"user":{"id":******,"is_bot":true,"first_name":"***Bot","username":"******"},"status":"member"}
	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:88) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:75) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at love.forte.simbot.telegram.type.ChatMemberUpdated$$serializer.deserialize(Chat.kt:1389) ~[simbot-component-telegram-type-jvm-0.0.9.jar:na]
	at love.forte.simbot.telegram.type.ChatMemberUpdated$$serializer.deserialize(Chat.kt:1389) ~[simbot-component-telegram-type-jvm-0.0.9.jar:na]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at love.forte.simbot.telegram.api.update.Update$$serializer.deserialize(Update.kt:50) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at love.forte.simbot.telegram.api.update.Update$$serializer.deserialize(Update.kt:50) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78) ~[kotlinx-serialization-core-jvm-1.6.3.jar:1.6.3]
	at love.forte.simbot.telegram.api.TelegramApiResult$$serializer.deserialize(TelegramApiResult.kt:40) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at love.forte.simbot.telegram.api.TelegramApiResult$$serializer.deserialize(TelegramApiResult.kt:40) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107) ~[kotlinx-serialization-json-jvm-1.6.3.jar:na]
	at love.forte.simbot.telegram.api.ApiRequests__ApiRequestsKt.requestResult(ApiRequests.kt:159) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at love.forte.simbot.telegram.api.ApiRequests.requestResult(ApiRequests.kt:1) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at love.forte.simbot.telegram.api.ApiRequests__ApiRequestsKt$requestResult$1.invokeSuspend(ApiRequests.kt) ~[simbot-component-telegram-api-jvm-0.0.9.jar:na]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]

Exception in thread "DefaultDispatcher-worker-10" kotlinx.serialization.json.internal.JsonDecodingException: Serializer for subclass 'member' is not found in the polymorphic scope of 'ChatMember'.
Check if class with serial name 'member' exists and serializer is registered in a corresponding SerializersModule.
To be registered automatically, class 'member' has to be '@Serializable', and the base class 'ChatMember' has to be sealed and '@Serializable'.
JSON input: {"user":{"id":******,"is_bot":true,"first_name":"***Bot","username":"******"},"status":"member"}
	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:88)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:75)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
	at love.forte.simbot.telegram.type.ChatMemberUpdated$$serializer.deserialize(Chat.kt:1389)
	at love.forte.simbot.telegram.type.ChatMemberUpdated$$serializer.deserialize(Chat.kt:1389)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78)
	at love.forte.simbot.telegram.api.update.Update$$serializer.deserialize(Update.kt:50)
	at love.forte.simbot.telegram.api.update.Update$$serializer.deserialize(Update.kt:50)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
	at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78)
	at love.forte.simbot.telegram.api.TelegramApiResult$$serializer.deserialize(TelegramApiResult.kt:40)
	at love.forte.simbot.telegram.api.TelegramApiResult$$serializer.deserialize(TelegramApiResult.kt:40)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
	at love.forte.simbot.telegram.api.ApiRequests__ApiRequestsKt.requestResult(ApiRequests.kt:159)
	at love.forte.simbot.telegram.api.ApiRequests.requestResult(ApiRequests.kt:1)
	at love.forte.simbot.telegram.api.ApiRequests__ApiRequestsKt$requestResult$1.invokeSuspend(ApiRequests.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@ea5571c, Dispatchers.Default]

复现方式

机器人启动后邀请机器人加入群聊后产生此报错,具体是什么原因暂时不确定.

相关日志

No response

其他补充

No response

Metadata

Metadata

Assignees

Labels

bug这是个BUG

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions