Commit 8ca3e657 authored by Him188's avatar Him188

Use MessageKey instead of MessageId

parent 3dfe7f6e
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
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment