mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 09:50:16 +08:00
Use MessageKey instead of MessageId
This commit is contained in:
parent
3dfe7f6e6f
commit
8ca3e6578d
@ -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 概念
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
package net.mamoe.mirai.message.defaults
|
package net.mamoe.mirai.message.defaults
|
||||||
|
|
||||||
import net.mamoe.mirai.message.Message
|
import net.mamoe.mirai.message.Message
|
||||||
import net.mamoe.mirai.message.MessageId
|
|
||||||
import net.mamoe.mirai.message.MessageKey
|
import net.mamoe.mirai.message.MessageKey
|
||||||
import net.mamoe.mirai.network.protocol.tim.packet.*
|
import net.mamoe.mirai.network.protocol.tim.packet.*
|
||||||
import net.mamoe.mirai.utils.lazyDecode
|
import net.mamoe.mirai.utils.lazyDecode
|
||||||
@ -27,7 +26,7 @@ open class Image(val imageId: String) : Message() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun toByteArray(): ByteArray = lazyEncode { section ->
|
override fun toByteArray(): ByteArray = lazyEncode { section ->
|
||||||
section.writeByte(MessageId.IMAGE)
|
section.writeByte(intValue)
|
||||||
|
|
||||||
section.writeLVByteArray(lazyEncode { child ->
|
section.writeLVByteArray(lazyEncode { child ->
|
||||||
child.writeByte(0x02)
|
child.writeByte(0x02)
|
||||||
|
Loading…
Reference in New Issue
Block a user