fix: FileMessage.Delegate SerialName (#2041)

This commit is contained in:
cssxsh 2022-05-18 16:07:31 +08:00 committed by GitHub
parent d8ceb7ae5b
commit a1a517c03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,7 @@ public interface FileMessage : MessageContent, ConstrainSingle, CodableMessage {
Mirai.createFileMessage(id, internalId, name, size)
}
public object Serializer : KSerializer<FileMessage> by FallbackSerializer("FileMessage") // not polymorphic
public object Serializer : KSerializer<FileMessage> by FallbackSerializer(SERIAL_NAME) // not polymorphic
@MiraiInternalApi
private open class FallbackSerializer(serialName: String) : KSerializer<FileMessage> by Delegate.serializer().map(
@ -121,7 +121,7 @@ public interface FileMessage : MessageContent, ConstrainSingle, CodableMessage {
serialize = { Delegate(id, internalId, name, size) },
deserialize = { Mirai.createFileMessage(id, internalId, name, size) },
) {
@SerialName(Image.SERIAL_NAME)
@SerialName(SERIAL_NAME)
@Serializable
data class Delegate(
val id: String,