fix build err

This commit is contained in:
白池 2024-04-04 19:44:56 +08:00 committed by GitHub
parent 9aef71b09f
commit 042f4bd330
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,11 +1,13 @@
package qq.service.msg package qq.service.msg
import com.google.protobuf.ByteString
import com.tencent.mobileqq.qroute.QRoute import com.tencent.mobileqq.qroute.QRoute
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant import com.tencent.qqnt.kernel.nativeinterface.MsgConstant
import com.tencent.qqnt.kernel.nativeinterface.MsgElement import com.tencent.qqnt.kernel.nativeinterface.MsgElement
import com.tencent.qqnt.kernel.nativeinterface.MsgRecord import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
import com.tencent.qqnt.msg.api.IMsgService import com.tencent.qqnt.msg.api.IMsgService
import io.kritor.common.* import io.kritor.common.*
import io.kritor.common.Element.ElementType
import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withTimeoutOrNull import kotlinx.coroutines.withTimeoutOrNull
import moe.fuqiuluo.shamrock.helper.ActionMsgException import moe.fuqiuluo.shamrock.helper.ActionMsgException
@ -154,8 +156,8 @@ private object MsgConvertor {
val elem = Element.newBuilder() val elem = Element.newBuilder()
elem.type = ElementType.IMAGE elem.type = ElementType.IMAGE
elem.setImage(ImageElement.newBuilder().apply { elem.setImage(ImageElement.newBuilder().apply {
this.file = md5 this.file = ByteString.copyFromUtf8(md5)
this.url = when (record.chatType) { this.fileUrl = when (record.chatType) {
MsgConstant.KCHATTYPEDISC, MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupPicDownUrl( MsgConstant.KCHATTYPEDISC, MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupPicDownUrl(
originalUrl = originalUrl, originalUrl = originalUrl,
md5 = md5, md5 = md5,
@ -194,7 +196,7 @@ private object MsgConvertor {
else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}") else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}")
} }
this.type = this.type =
if (image.isFlashPic == true) ImageType.FLASH else if (image.original) ImageType.ORIGIN else ImageType.COMMON if (image.isFlashPic == true) ImageElement.ImageType.FLASH else if (image.original) ImageElement.ImageType.ORIGIN else ImageElement.ImageType.COMMON
this.subType = image.picSubType this.subType = image.picSubType
}) })
@ -211,7 +213,7 @@ private object MsgConvertor {
elem.type = ElementType.VOICE elem.type = ElementType.VOICE
elem.setVoice(VoiceElement.newBuilder().apply { elem.setVoice(VoiceElement.newBuilder().apply {
this.url = when (record.chatType) { this.fileUrl = when (record.chatType) {
MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CPttDownUrl("0", ptt.fileUuid) MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CPttDownUrl("0", ptt.fileUuid)
MsgConstant.KCHATTYPEGROUP, MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupPttDownUrl( MsgConstant.KCHATTYPEGROUP, MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupPttDownUrl(
"0", "0",
@ -221,7 +223,7 @@ private object MsgConvertor {
else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}") else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}")
} }
this.file = md5 this.file = ByteString.copyFromUtf8(md5)
this.magic = ptt.voiceChangeType != MsgConstant.KPTTVOICECHANGETYPENONE this.magic = ptt.voiceChangeType != MsgConstant.KPTTVOICECHANGETYPENONE
}) })
@ -240,8 +242,8 @@ private object MsgConvertor {
} else video.fileName.split(".")[0].hex2ByteArray() } else video.fileName.split(".")[0].hex2ByteArray()
elem.type = ElementType.VIDEO elem.type = ElementType.VIDEO
elem.setVideo(VideoElement.newBuilder().apply { elem.setVideo(VideoElement.newBuilder().apply {
this.file = md5.toHexString() this.file = ByteString.copyFromUtf8(md5.toHexString())
this.url = when (record.chatType) { this.fileUrl = when (record.chatType) {
MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid) MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid)
MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CVideoDownUrl("0", md5, video.fileUuid) MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CVideoDownUrl("0", md5, video.fileUuid)
MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid) MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid)
@ -334,9 +336,9 @@ private object MsgConvertor {
} }
if (sourceRecords.isNullOrEmpty()) { if (sourceRecords.isNullOrEmpty()) {
LogCenter.log("无法查询到回复的消息ID: seq = $msgSeq", Level.WARN) LogCenter.log("无法查询到回复的消息ID: seq = $msgSeq", Level.WARN)
this.messageId = reply.replayMsgId this.messageId = reply.replayMsgId.toString()
} else { } else {
this.messageId = sourceRecords.first().msgId this.messageId = sourceRecords.first().msgId.toString()
} }
}) })
return Result.success(elem.build()) return Result.success(elem.build())