mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-15 04:50:11 +08:00
Update doc
This commit is contained in:
parent
10aa950b63
commit
ac9a445abf
@ -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
|
|||||||
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
|
|||||||
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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user