mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-03 22:30:12 +08:00
[core] Fix group audio url fetching. fix #2269
This commit is contained in:
parent
faa7ebeaba
commit
9eef7d3787
@ -31,6 +31,7 @@ import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
|||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm
|
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgOnlinePush
|
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgOnlinePush
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.Oidb0x8fc
|
import net.mamoe.mirai.internal.network.protocol.data.proto.Oidb0x8fc
|
||||||
|
import net.mamoe.mirai.internal.network.protocol.packet.chat.voice.PttStore
|
||||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||||
import net.mamoe.mirai.message.data.MessageSourceKind
|
import net.mamoe.mirai.message.data.MessageSourceKind
|
||||||
import net.mamoe.mirai.utils.*
|
import net.mamoe.mirai.utils.*
|
||||||
@ -104,6 +105,26 @@ internal class GroupMessageProcessor(
|
|||||||
elem.anonGroupMsg != null -> anonymous = elem.anonGroupMsg
|
elem.anonGroupMsg != null -> anonymous = elem.anonGroupMsg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.msg.msgBody.richText.ptt?.let pttPatch@{ ptt ->
|
||||||
|
if (ptt.downPara.isNotEmpty()) return@pttPatch
|
||||||
|
|
||||||
|
kotlin.runCatching {
|
||||||
|
val response = bot.network.sendAndExpect(
|
||||||
|
PttStore.GroupPttDown(
|
||||||
|
bot.client,
|
||||||
|
group.groupCode,
|
||||||
|
ptt,
|
||||||
|
msg.msg
|
||||||
|
),
|
||||||
|
5000,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
|
||||||
|
ptt.downPara =
|
||||||
|
"http://${response.strDomain}${response.downPara.decodeToString()}".encodeToByteArray()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ import net.mamoe.mirai.internal.network.Packet
|
|||||||
import net.mamoe.mirai.internal.network.QQAndroidClient
|
import net.mamoe.mirai.internal.network.QQAndroidClient
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x346
|
import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x346
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x388
|
import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x388
|
||||||
|
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||||
|
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm
|
||||||
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory
|
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory
|
||||||
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketWithRespType
|
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketWithRespType
|
||||||
import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket
|
import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket
|
||||||
@ -148,6 +150,36 @@ internal class PttStore {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator fun invoke(
|
||||||
|
client: QQAndroidClient,
|
||||||
|
groupCode: Long,
|
||||||
|
ptt: ImMsgBody.Ptt,
|
||||||
|
msg: MsgComm.Msg,
|
||||||
|
) = buildOutgoingUniPacket(client) {
|
||||||
|
writeProtoBuf(
|
||||||
|
Cmd0x388.ReqBody.serializer(), Cmd0x388.ReqBody(
|
||||||
|
netType = 3, // wifi
|
||||||
|
subcmd = 4,
|
||||||
|
msgGetpttUrlReq = listOf(
|
||||||
|
Cmd0x388.GetPttUrlReq(
|
||||||
|
groupCode = groupCode,
|
||||||
|
fileid = 0,
|
||||||
|
fileId = ptt.fileId.toLong(),
|
||||||
|
fileMd5 = ptt.fileMd5,
|
||||||
|
dstUin = msg.msgHead.toUin,
|
||||||
|
fileKey = ptt.groupFileKey,
|
||||||
|
buType = 3,
|
||||||
|
innerIp = 0,
|
||||||
|
buildVer = "8.5.5".encodeToByteArray(),
|
||||||
|
codec = 0,
|
||||||
|
reqTerm = 5,
|
||||||
|
reqPlatformType = 9,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalStdlibApi::class)
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
operator fun invoke(
|
operator fun invoke(
|
||||||
client: QQAndroidClient,
|
client: QQAndroidClient,
|
||||||
@ -167,7 +199,7 @@ internal class PttStore {
|
|||||||
dstUin = dstUin,
|
dstUin = dstUin,
|
||||||
buType = 4,
|
buType = 4,
|
||||||
innerIp = 0,
|
innerIp = 0,
|
||||||
buildVer = "6.5.5.663".encodeToByteArray(),
|
buildVer = "8.5.5".encodeToByteArray(),
|
||||||
codec = 0,
|
codec = 0,
|
||||||
reqTerm = 5,
|
reqTerm = 5,
|
||||||
reqPlatformType = 9
|
reqPlatformType = 9
|
||||||
|
Loading…
Reference in New Issue
Block a user