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

Fix Number Interaction Option deserialization #360

Merged
merged 1 commit into from
Aug 7, 2021
Merged

Fix Number Interaction Option deserialization #360

merged 1 commit into from
Aug 7, 2021

Conversation

MrPowerGamerBR
Copy link
Contributor

Currently you aren't able to use the "number" option because it always fails to deserialize, this fixes the issue.

Currently you aren't able to use the "number" option because it always fails to deserialize, this fixes the issue.
@MrPowerGamerBR
Copy link
Contributor Author

MrPowerGamerBR commented Aug 6, 2021

Here's the stacktrace of the error

java.lang.IllegalStateException: unknown ApplicationCommandOptionType dev.kord.common.entity.ApplicationCommandOptionType$Number@4667c78b
	at dev.kord.common.entity.Option$Serializer.deserialize(Interactions.kt:338)
	at dev.kord.common.entity.Option$Serializer.deserialize(Interactions.kt:277)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
	at kotlinx.serialization.internal.ListLikeSerializer.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.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at dev.kord.common.entity.optional.Optional$OptionalSerializer.deserialize(Optional.kt:173)
	at dev.kord.common.entity.optional.Optional$OptionalSerializer.deserialize(Optional.kt:151)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at dev.kord.common.entity.InteractionCallbackData$$serializer.deserialize(Interactions.kt:258)
	at dev.kord.common.entity.InteractionCallbackData$$serializer.deserialize(Interactions.kt:258)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at dev.kord.common.entity.DiscordInteraction$$serializer.deserialize(Interactions.kt:165)
	at dev.kord.common.entity.DiscordInteraction$$serializer.deserialize(Interactions.kt:165)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)
	at net.perfectdreams.discordinteraktions.webserver.KtorInteractionsKt$installDiscordInteractions$1.invokeSuspend(KtorInteractions.kt:85)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda-1$lambda-0(NettyApplicationEngine.kt:251)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

@MrPowerGamerBR MrPowerGamerBR changed the title Fix Number Interaction Option serialization/deserialization Fix Number Interaction Option deserialization Aug 6, 2021
@HopeBaron HopeBaron merged commit 4dec1a3 into kordlib:0.8.x Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants