Skip to content

QueueEndEvents are not serialized properly #3

@MrOctopus

Description

@MrOctopus

Currently QueueEndEvents are not serialized properly due to how https://github.com/topi314/LavaQueue/blob/master/protocol/src/commonMain/kotlin/com/github/topi314/lavaqueue/protocol/messages.kt#L9 is setup. This causes the op and type variables to not be sent in the message body to Lavalink clients.

I am no Kotlin expert, but I am guessing this is due to them being defined in the data class body as static properties.

@SerialName("ready")
@Serializable
data class QueueEndEvent(
    val guildId: String
) {
    val op: Message.Op = Message.Op.Event
    val type: String = "QueueEndEvent"
}

I personally solved the problem by just encoding the values as defaults instead, but there's probably a better way to go about doing this:

@SerialName("event")
@Serializable
data class QueueEndEvent(
    val guildId: String,
    @EncodeDefault
    val op: Message.Op = Message.Op.Event,
    @EncodeDefault
    val type: String = "QueueEndEvent"
)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions