mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 03:22:36 +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 {
|
||||
add(" ")
|
||||
add(Face(Face.hao))
|
||||
add(Face(Face.OK))
|
||||
add(TestConstrainSingleMessage())
|
||||
add(
|
||||
PlainText("ss")
|
||||
|
@ -148,7 +148,13 @@ internal fun MessageChain.toRichTextElems(
|
||||
is OfflineFriendImage -> elements.add(ImMsgBody.Elem(notOnlineImage = it.toJceData()))
|
||||
is FlashImage -> elements.add(it.toJceData()).also { transformOneMessage(UNSUPPORTED_FLASH_MESSAGE_PLAIN) }
|
||||
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 -> {
|
||||
if (forGroup) {
|
||||
when (val source = it.source) {
|
||||
@ -512,6 +518,11 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, botId:
|
||||
list.add(FlashImage(OnlineFriendImageImpl(proto.flashC2cPic)))
|
||||
}
|
||||
}
|
||||
33 -> {
|
||||
val proto = element.commonElem.pbElem.loadAs(HummerCommelem.MsgElemInfoServtype33.serializer())
|
||||
list.add(Face(proto.index))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
|
@ -9,8 +9,11 @@
|
||||
|
||||
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.utils.hexToBytes
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.toByteArray
|
||||
import net.mamoe.mirai.internal.utils.toByteArray
|
||||
import net.mamoe.mirai.message.data.Face
|
||||
|
||||
@ -23,3 +26,16 @@ internal fun Face.toJceData(): ImMsgBody.Face {
|
||||
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 net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY
|
||||
import net.mamoe.mirai.internal.utils.io.ProtoBuf
|
||||
import kotlin.jvm.JvmField
|
||||
|
||||
internal class HummerCommelem : ProtoBuf {
|
||||
@Serializable
|
||||
@ -234,6 +233,14 @@ internal class HummerCommelem : ProtoBuf {
|
||||
@ProtoNumber(2) @JvmField val ext: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : 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
|
||||
internal class MsgElemInfoServtype4(
|
||||
@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(
|
||||
|
||||
0x8AL to lambda528 { bot ->
|
||||
@Serializable
|
||||
class Wording(
|
||||
@ProtoNumber(1) val itemID: Int = 0,
|
||||
@ProtoNumber(2) val itemName: String = ""
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
class Sub8AMsgInfo(
|
||||
@ProtoNumber(1) val fromUin: Long,
|
||||
@ProtoNumber(2) val botUin: Long,
|
||||
@ProtoNumber(3) val srcId: Int,
|
||||
@ProtoNumber(4) val srcInternalId: Int,
|
||||
@ProtoNumber(5) val time: Int,
|
||||
@ProtoNumber(6) val random: Int, // 同srcInternalId
|
||||
@ProtoNumber(4) val srcInternalId: Long,
|
||||
@ProtoNumber(5) val time: Long,
|
||||
@ProtoNumber(6) val random: Int,
|
||||
@ProtoNumber(7) val pkgNum: Int, // 1
|
||||
@ProtoNumber(8) val pkgIndex: Int, // 0
|
||||
@ProtoNumber(9) val devSeq: Int, // 0
|
||||
@ProtoNumber(10) val unknown1: Int = 0, // ? 补 id
|
||||
@ProtoNumber(11) val unknown2: Int = 0, // ?
|
||||
@ProtoNumber(12) val flag: Int // 1
|
||||
@ProtoNumber(12) val flag: Int, // 1
|
||||
@ProtoNumber(13) val wording: Wording
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
@ -442,8 +447,8 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
||||
MessageRecallEvent.FriendRecall(
|
||||
bot = bot,
|
||||
messageIds = intArrayOf(it.srcId),
|
||||
messageInternalIds = intArrayOf(it.srcInternalId),
|
||||
messageTime = it.time,
|
||||
messageInternalIds = intArrayOf(it.srcInternalId.toInt()),
|
||||
messageTime = it.time.toInt(),
|
||||
operatorId = it.fromUin
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user