Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telegramBot的member序列化问题 #891

Closed
Flock-YT opened this issue Jul 24, 2024 · 3 comments · Fixed by simple-robot/simbot-component-telegram#32
Closed

telegramBot的member序列化问题 #891

Flock-YT opened this issue Jul 24, 2024 · 3 comments · Fixed by simple-robot/simbot-component-telegram#32
Assignees
Labels
bug 这是个BUG

Comments

@Flock-YT
Copy link

Flock-YT commented Jul 24, 2024

是否会提供贡献?

版本号

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

@Flock-YT Flock-YT added the bug? 疑似为bug、存在普遍性问题、待确认 label Jul 24, 2024
@ForliyScarlet ForliyScarlet added the 等待确认 等待负责人员的确认 label Jul 24, 2024
@ForteScarlet ForteScarlet added bug 这是个BUG and removed bug? 疑似为bug、存在普遍性问题、待确认 labels Jul 24, 2024
@ForteScarlet
Copy link
Member

应当是序列化信息缺失导致的,暂认为bug

@ForteScarlet ForteScarlet removed the 等待确认 等待负责人员的确认 label Jul 24, 2024
@Flock-YT
Copy link
Author

发现只要先把机器人拉进群再启动就不会有这个问题( 前提是首次启动

@ForteScarlet
Copy link
Member

那应该是邀请事件中涉及到了相关的序列化类型

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 这是个BUG
Projects
None yet
3 participants