mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 11:30:16 +08:00
Internal optimizations
This commit is contained in:
parent
9c7181779f
commit
3ac188bb64
@ -137,7 +137,8 @@ public sealed class CustomMessage : SingleMessage {
|
||||
public class CustomMessageFullDataDeserializeUserException(public val body: ByteArray, cause: Throwable?) :
|
||||
RuntimeException(cause)
|
||||
|
||||
internal fun load(fullData: ByteReadPacket): CustomMessage? {
|
||||
@MiraiInternalApi
|
||||
public fun load(fullData: ByteReadPacket): CustomMessage? {
|
||||
val msg = kotlin.runCatching {
|
||||
val length = fullData.readInt()
|
||||
if (fullData.remaining != length.toLong()) {
|
||||
@ -157,7 +158,8 @@ public sealed class CustomMessage : SingleMessage {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun <M : CustomMessage> dump(factory: Factory<M>, message: M): ByteArray = buildPacket {
|
||||
@MiraiInternalApi
|
||||
public fun <M : CustomMessage> dump(factory: Factory<M>, message: M): ByteArray = buildPacket {
|
||||
ProtoBuf.encodeToByteArray(
|
||||
CustomMessageFullData.serializer(), CustomMessageFullData(
|
||||
miraiVersionFlag = 1,
|
||||
|
@ -17,6 +17,7 @@ import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.mamoe.mirai.message.code.CodableMessage
|
||||
import net.mamoe.mirai.message.data.VipFace.Kind
|
||||
import net.mamoe.mirai.utils.MiraiInternalApi
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
import net.mamoe.mirai.utils.castOrNull
|
||||
import net.mamoe.mirai.utils.safeCast
|
||||
@ -47,7 +48,7 @@ public sealed class HummerMessage : MessageContent, ConstrainSingle {
|
||||
* @see PokeMessage.Companion 使用伴生对象中的常量
|
||||
*/
|
||||
@Serializable
|
||||
public data class PokeMessage internal constructor(
|
||||
public data class PokeMessage @MiraiInternalApi constructor(
|
||||
/**
|
||||
* 仅 mirai, 显示的名称
|
||||
*/
|
||||
@ -196,7 +197,7 @@ public data class PokeMessage internal constructor(
|
||||
* @see VipFace.Key 使用伴生对象中的常量
|
||||
*/
|
||||
@Serializable
|
||||
public data class VipFace internal constructor(
|
||||
public data class VipFace @MiraiInternalApi constructor(
|
||||
/**
|
||||
* 使用 [Companion] 中常量.
|
||||
*/
|
||||
|
@ -380,7 +380,6 @@ internal inline fun <reified R> Iterable<*>.firstIsInstanceOrNull(): R? {
|
||||
|
||||
internal val MIRAI_CUSTOM_ELEM_TYPE = "mirai".hashCode() // 103904510
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, botId: Long, list: MessageChainBuilder) {
|
||||
// (this._miraiContentToString().soutv())
|
||||
this.forEach { element ->
|
||||
|
Loading…
Reference in New Issue
Block a user