1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-25 04:50:26 +08:00

Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Him188 2020-12-20 08:22:21 +08:00
commit 4474a86e59
6 changed files with 20 additions and 7 deletions
docs
mirai-core-api/src/commonMain/kotlin/message/data
mirai-core/src/commonMain/kotlin
contact
message
network/protocol/packet/chat/receive

View File

@ -26,10 +26,14 @@ mirai 已经可以用于各项工作,但我们并不保证完全的稳定。
阅读 [项目整体架构](mirai.md#%E9%A1%B9%E7%9B%AE%E6%95%B4%E4%BD%93%E6%9E%B6%E6%9E%84).
**警告:** mirai 开发者自愿花费其休息时间,无偿维护 mirai 系列项目,**但没有义务提供任何方面的帮助**。
使用者应秉持对开发者无私贡献的尊重,而不应该期望得到帮助。
使用者应秉持对开发者无私贡献的尊重,而不应该期望得到帮助。
### 启动 Mirai 时遇到 java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
请更换 OpenJDK。该问题是由于BouncyCastle在重打包后丢失Jar签名引起的。
~~多发于Oracle JDK~~
## 开发相关
> 欢迎帮助维护这个问题列表: 提交 PR 或者 issue.
... 待补充
... 待补充

View File

@ -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() {

View File

@ -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, "")
}
}

View File

@ -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) {

View File

@ -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
}
}
)
}
)

View File

@ -243,7 +243,7 @@ private object Transformers732 : Map<Int, Lambda732> by mapOf(
val grayTip = readProtoBuf(TroopTips0x857.NotifyMsgBody.serializer()).optGeneralGrayTip
when (grayTip?.templId) {
//戳一戳
10043L, 1134L, 1135L, 1136L -> {
10043L, 1133L, 1132L, 1134L, 1135L, 1136L -> {
//预置数据,服务器将不会提供己方已知消息
var action = ""
var from: Member = group.botAsMember
@ -509,7 +509,7 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
val body = vProtobuf.loadAs(Submsgtype0x122.Submsgtype0x122.MsgBody.serializer())
when (body.templId) {
//戳一戳
1134L, 1135L, 1136L, 10043L -> {
1132L, 1133L, 1134L, 1135L, 1136L, 10043L -> {
//预置数据,服务器将不会提供己方已知消息
var from: Friend = bot.asFriend
var action = ""