Commit ac9a445a authored by Him188's avatar Him188

Update doc

parent 10aa950b
...@@ -118,7 +118,7 @@ fun ByteReadPacket.readMessageChain(): MessageChain { ...@@ -118,7 +118,7 @@ fun ByteReadPacket.readMessageChain(): MessageChain {
} }
fun MessageChain.toPacket(): ByteReadPacket = buildPacket { fun MessageChain.toPacket(): ByteReadPacket = buildPacket {
this@toPacket.list.forEach { message -> this@toPacket.forEach { message ->
writePacket(with(message) { writePacket(with(message) {
when (this) { when (this) {
is Face -> buildPacket { is Face -> buildPacket {
......
...@@ -5,6 +5,9 @@ package net.mamoe.mirai.network.protocol.tim.packet ...@@ -5,6 +5,9 @@ package net.mamoe.mirai.network.protocol.tim.packet
import net.mamoe.mirai.utils.hexToUBytes import net.mamoe.mirai.utils.hexToUBytes
/**
* 数据包
*/
abstract class Packet { abstract class Packet {
open val idHex: String by lazy { open val idHex: String by lazy {
this::class.annotations.filterIsInstance<PacketId>().firstOrNull()?.value?.trim() ?: "" this::class.annotations.filterIsInstance<PacketId>().firstOrNull()?.value?.trim() ?: ""
......
...@@ -9,6 +9,9 @@ import kotlinx.io.core.readBytes ...@@ -9,6 +9,9 @@ import kotlinx.io.core.readBytes
import net.mamoe.mirai.utils.* import net.mamoe.mirai.utils.*
/**
* 来自服务器的数据包
*/
abstract class ServerPacket(val input: ByteReadPacket) : Packet(), Closeable { abstract class ServerPacket(val input: ByteReadPacket) : Packet(), Closeable {
override var idHex: String = EMPTY_ID_HEX override var idHex: String = EMPTY_ID_HEX
get() { get() {
......
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