mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 11:30:16 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
2aacfe4064
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@ internal class ConstrainSingleTest {
|
|||||||
|
|
||||||
val result = buildMessageChain {
|
val result = buildMessageChain {
|
||||||
add(" ")
|
add(" ")
|
||||||
add(Face(Face.hao))
|
add(Face(Face.OK))
|
||||||
add(TestConstrainSingleMessage())
|
add(TestConstrainSingleMessage())
|
||||||
add(
|
add(
|
||||||
PlainText("ss")
|
PlainText("ss")
|
||||||
|
@ -148,7 +148,13 @@ internal fun MessageChain.toRichTextElems(
|
|||||||
is OfflineFriendImage -> elements.add(ImMsgBody.Elem(notOnlineImage = it.toJceData()))
|
is OfflineFriendImage -> elements.add(ImMsgBody.Elem(notOnlineImage = it.toJceData()))
|
||||||
is FlashImage -> elements.add(it.toJceData()).also { transformOneMessage(UNSUPPORTED_FLASH_MESSAGE_PLAIN) }
|
is FlashImage -> elements.add(it.toJceData()).also { transformOneMessage(UNSUPPORTED_FLASH_MESSAGE_PLAIN) }
|
||||||
is AtAll -> elements.add(atAllData)
|
is AtAll -> elements.add(atAllData)
|
||||||
is Face -> elements.add(ImMsgBody.Elem(face = it.toJceData()))
|
is Face -> elements.add(
|
||||||
|
if (it.id >= 260) {
|
||||||
|
ImMsgBody.Elem(commonElem = it.toCommData())
|
||||||
|
} else {
|
||||||
|
ImMsgBody.Elem(face = it.toJceData())
|
||||||
|
}
|
||||||
|
)
|
||||||
is QuoteReply -> {
|
is QuoteReply -> {
|
||||||
if (forGroup) {
|
if (forGroup) {
|
||||||
when (val source = it.source) {
|
when (val source = it.source) {
|
||||||
@ -512,6 +518,11 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, botId:
|
|||||||
list.add(FlashImage(OnlineFriendImageImpl(proto.flashC2cPic)))
|
list.add(FlashImage(OnlineFriendImageImpl(proto.flashC2cPic)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33 -> {
|
||||||
|
val proto = element.commonElem.pbElem.loadAs(HummerCommelem.MsgElemInfoServtype33.serializer())
|
||||||
|
list.add(Face(proto.index))
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -9,8 +9,11 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.internal.message
|
package net.mamoe.mirai.internal.message
|
||||||
|
|
||||||
|
import kotlinx.io.core.toByteArray
|
||||||
|
import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||||
import net.mamoe.mirai.internal.utils.hexToBytes
|
import net.mamoe.mirai.internal.utils.hexToBytes
|
||||||
|
import net.mamoe.mirai.internal.utils.io.serialization.toByteArray
|
||||||
import net.mamoe.mirai.internal.utils.toByteArray
|
import net.mamoe.mirai.internal.utils.toByteArray
|
||||||
import net.mamoe.mirai.message.data.Face
|
import net.mamoe.mirai.message.data.Face
|
||||||
|
|
||||||
@ -23,3 +26,16 @@ internal fun Face.toJceData(): ImMsgBody.Face {
|
|||||||
buf = FACE_BUF
|
buf = FACE_BUF
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun Face.toCommData(): ImMsgBody.CommonElem {
|
||||||
|
return ImMsgBody.CommonElem(
|
||||||
|
serviceType = 33,
|
||||||
|
pbElem = HummerCommelem.MsgElemInfoServtype33(
|
||||||
|
index = this.id,
|
||||||
|
name = "/${this.name}".toByteArray(),
|
||||||
|
compat = "/${this.name}".toByteArray()
|
||||||
|
).toByteArray(HummerCommelem.MsgElemInfoServtype33.serializer()),
|
||||||
|
businessType = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -13,7 +13,6 @@ import kotlinx.serialization.Serializable
|
|||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY
|
import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY
|
||||||
import net.mamoe.mirai.internal.utils.io.ProtoBuf
|
import net.mamoe.mirai.internal.utils.io.ProtoBuf
|
||||||
import kotlin.jvm.JvmField
|
|
||||||
|
|
||||||
internal class HummerCommelem : ProtoBuf {
|
internal class HummerCommelem : ProtoBuf {
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -234,6 +233,14 @@ internal class HummerCommelem : ProtoBuf {
|
|||||||
@ProtoNumber(2) @JvmField val ext: ByteArray = EMPTY_BYTE_ARRAY
|
@ProtoNumber(2) @JvmField val ext: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
) : ProtoBuf
|
) : ProtoBuf
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
internal class MsgElemInfoServtype33(
|
||||||
|
@ProtoNumber(1) @JvmField val index: Int = 0,
|
||||||
|
@ProtoNumber(2) @JvmField val name: ByteArray = EMPTY_BYTE_ARRAY,
|
||||||
|
@ProtoNumber(3) @JvmField val compat: ByteArray = EMPTY_BYTE_ARRAY,
|
||||||
|
@ProtoNumber(4) @JvmField val buf: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
|
) : ProtoBuf
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
internal class MsgElemInfoServtype4(
|
internal class MsgElemInfoServtype4(
|
||||||
@ProtoNumber(1) @JvmField val imsgType: Int = 0,
|
@ProtoNumber(1) @JvmField val imsgType: Int = 0,
|
||||||
|
@ -412,20 +412,25 @@ internal inline fun lambda528(crossinline block: MsgType0x210.(QQAndroidBot, Msg
|
|||||||
internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
||||||
|
|
||||||
0x8AL to lambda528 { bot ->
|
0x8AL to lambda528 { bot ->
|
||||||
|
@Serializable
|
||||||
|
class Wording(
|
||||||
|
@ProtoNumber(1) val itemID: Int = 0,
|
||||||
|
@ProtoNumber(2) val itemName: String = ""
|
||||||
|
) : ProtoBuf
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Sub8AMsgInfo(
|
class Sub8AMsgInfo(
|
||||||
@ProtoNumber(1) val fromUin: Long,
|
@ProtoNumber(1) val fromUin: Long,
|
||||||
@ProtoNumber(2) val botUin: Long,
|
@ProtoNumber(2) val botUin: Long,
|
||||||
@ProtoNumber(3) val srcId: Int,
|
@ProtoNumber(3) val srcId: Int,
|
||||||
@ProtoNumber(4) val srcInternalId: Int,
|
@ProtoNumber(4) val srcInternalId: Long,
|
||||||
@ProtoNumber(5) val time: Int,
|
@ProtoNumber(5) val time: Long,
|
||||||
@ProtoNumber(6) val random: Int, // 同srcInternalId
|
@ProtoNumber(6) val random: Int,
|
||||||
@ProtoNumber(7) val pkgNum: Int, // 1
|
@ProtoNumber(7) val pkgNum: Int, // 1
|
||||||
@ProtoNumber(8) val pkgIndex: Int, // 0
|
@ProtoNumber(8) val pkgIndex: Int, // 0
|
||||||
@ProtoNumber(9) val devSeq: Int, // 0
|
@ProtoNumber(9) val devSeq: Int, // 0
|
||||||
@ProtoNumber(10) val unknown1: Int = 0, // ? 补 id
|
@ProtoNumber(12) val flag: Int, // 1
|
||||||
@ProtoNumber(11) val unknown2: Int = 0, // ?
|
@ProtoNumber(13) val wording: Wording
|
||||||
@ProtoNumber(12) val flag: Int // 1
|
|
||||||
) : ProtoBuf
|
) : ProtoBuf
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -442,8 +447,8 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
|||||||
MessageRecallEvent.FriendRecall(
|
MessageRecallEvent.FriendRecall(
|
||||||
bot = bot,
|
bot = bot,
|
||||||
messageIds = intArrayOf(it.srcId),
|
messageIds = intArrayOf(it.srcId),
|
||||||
messageInternalIds = intArrayOf(it.srcInternalId),
|
messageInternalIds = intArrayOf(it.srcInternalId.toInt()),
|
||||||
messageTime = it.time,
|
messageTime = it.time.toInt(),
|
||||||
operatorId = it.fromUin
|
operatorId = it.fromUin
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user