Use MessageKey instead of MessageId

This commit is contained in:
Him188 2019-10-07 13:50:36 +08:00
parent 3dfe7f6e6f
commit 8ca3e6578d
2 changed files with 1 additions and 24 deletions

View File

@ -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 概念
}

View File

@ -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)