Replace object IgnoredEventPacket with inline class IgnoredEventPacket to identify each packet

This commit is contained in:
Him188 2019-11-23 23:38:54 +08:00
parent 0662dc839f
commit bab2fce71b

View File

@ -5,7 +5,9 @@ package net.mamoe.mirai.network.protocol.tim.packet.event
import kotlinx.io.core.ByteReadPacket
import net.mamoe.mirai.Bot
object IgnoredEventPacket : EventPacket
inline class IgnoredEventPacket(val id: UShort) : EventPacket {
override fun toString(): String = "IgnoredEventPacket(id=$id)"
}
object IgnoredEventIds : List<IgnoredEventParserAndHandler> by {
listOf(
@ -15,5 +17,5 @@ object IgnoredEventIds : List<IgnoredEventParserAndHandler> by {
}()
inline class IgnoredEventParserAndHandler(override val id: UShort) : EventParserAndHandler<IgnoredEventPacket> {
override suspend fun ByteReadPacket.parse(bot: Bot, identity: EventPacketIdentity): IgnoredEventPacket = IgnoredEventPacket
override suspend fun ByteReadPacket.parse(bot: Bot, identity: EventPacketIdentity): IgnoredEventPacket = IgnoredEventPacket(id)
}