mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 02:29:21 +08:00
Fix #577
This commit is contained in:
parent
176ae71e7a
commit
ea113dd246
@ -39,6 +39,7 @@ public class Voice @MiraiInternalApi constructor(
|
||||
public override val fileName: String,
|
||||
public override val md5: ByteArray,
|
||||
public override val fileSize: Long,
|
||||
public val codec: Int = 0,
|
||||
private val _url: String
|
||||
) : PttMessage() {
|
||||
|
||||
|
@ -453,7 +453,7 @@ internal class GroupImpl(
|
||||
response.fileKey,
|
||||
codec
|
||||
)
|
||||
Voice("${md5.toUHexString("")}.amr", md5, content.size.toLong(), "")
|
||||
Voice("${md5.toUHexString("")}.amr", md5, content.size.toLong(), codec, "")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ internal fun MsgComm.Msg.toMessageChain(
|
||||
// 4 -> Voice(String(fileName), fileMd5, fileSize.toLong(),String(downPara))
|
||||
// else -> null
|
||||
// }
|
||||
Voice(String(fileName), fileMd5, fileSize.toLong(), String(downPara))
|
||||
Voice(String(fileName), fileMd5, fileSize.toLong(), format, String(downPara))
|
||||
}
|
||||
|
||||
return buildMessageChain(elements.size + 1 + if (pptMsg == null) 0 else 1) {
|
||||
|
@ -35,6 +35,7 @@ import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf
|
||||
import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.message.data.PttMessage
|
||||
import net.mamoe.mirai.message.data.Voice
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
@ -145,7 +146,14 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
|
||||
boolValid = true,
|
||||
fileSize = fileSize.toInt(),
|
||||
fileType = 4,
|
||||
pbReserve = byteArrayOf(0)
|
||||
pbReserve = byteArrayOf(0),
|
||||
format = let {
|
||||
if (it is Voice) {
|
||||
it.codec
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user