From 8ca3e6578deebd8e8e0481a74a5e9d9d80b6ca07 Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 7 Oct 2019 13:50:36 +0800 Subject: [PATCH] Use MessageKey instead of MessageId --- .../net/mamoe/mirai/message/MessageId.kt | 22 ------------------- .../net/mamoe/mirai/message/defaults/Image.kt | 3 +-- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageId.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageId.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageId.kt deleted file mode 100644 index 024736652..000000000 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageId.kt +++ /dev/null @@ -1,22 +0,0 @@ -package net.mamoe.mirai.message - -/** - * [Message] 在数据包中的 id([UByte]) - * - * Java 调用方式: - * MessageId.at - * - * @author Him188moe - */ -object MessageId { - - const val AT: Int = 0x06 - - const val FACE: Int = 0x02 - - const val TEXT: Int = 0x01 - - const val IMAGE: Int = 0x03 - - const val CHAIN: Int = 0xff//仅用于 equals. Packet 中不存在 Chain 概念 -} \ No newline at end of file diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/defaults/Image.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/defaults/Image.kt index 00e686820..b2a1a633e 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/defaults/Image.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/defaults/Image.kt @@ -1,7 +1,6 @@ package net.mamoe.mirai.message.defaults import net.mamoe.mirai.message.Message -import net.mamoe.mirai.message.MessageId import net.mamoe.mirai.message.MessageKey import net.mamoe.mirai.network.protocol.tim.packet.* import net.mamoe.mirai.utils.lazyDecode @@ -27,7 +26,7 @@ open class Image(val imageId: String) : Message() { } override fun toByteArray(): ByteArray = lazyEncode { section -> - section.writeByte(MessageId.IMAGE) + section.writeByte(intValue) section.writeLVByteArray(lazyEncode { child -> child.writeByte(0x02)