Shamrock: fix scene and group code

This commit is contained in:
ikechan8370 2024-04-10 21:09:10 +08:00
parent 36a09ca088
commit 7baf459b2a
2 changed files with 9 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package kritor.service
import io.grpc.Status
import io.grpc.StatusRuntimeException
import io.kritor.group.*
import moe.fuqiuluo.shamrock.helper.LogCenter
import moe.fuqiuluo.shamrock.helper.TroopHonorHelper.decodeHonor
import moe.fuqiuluo.shamrock.tools.ifNullOrEmpty
import qq.service.contact.ContactHelper
@ -213,9 +214,10 @@ internal object GroupService : GroupServiceGrpcKt.GroupServiceCoroutineImplBase(
return GetGroupListResponse.newBuilder().apply {
groupList.forEach { groupInfo ->
this.addGroupsInfo(GroupInfo.newBuilder().apply {
groupId = groupInfo.troopcode.toLong()
groupId = groupInfo.troopcode.ifNullOrEmpty { groupInfo.uin }.ifNullOrEmpty { groupInfo.troopuin }?.toLong() ?: 0
groupName = groupInfo.troopname.ifNullOrEmpty { groupInfo.troopRemark }
.ifNullOrEmpty { groupInfo.newTroopName } ?: ""
.ifNullOrEmpty { groupInfo.newTroopName }
?: ""
groupRemark = groupInfo.troopRemark ?: ""
owner = groupInfo.troopowneruin?.toLong() ?: 0
addAllAdmins(GroupHelper.getAdminList(groupId))

View File

@ -7,6 +7,7 @@ import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
import io.kritor.event.*
import io.kritor.common.PushMessageBody
import io.kritor.common.Contact
import io.kritor.common.Scene
import io.kritor.common.Sender
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
@ -44,7 +45,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.GROUP
this.peer = record.peerUin.toString()
this.subPeer = record.peerUid
}.build()
@ -67,7 +68,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.FRIEND
this.peer = record.senderUin.toString()
this.subPeer = record.senderUid
}.build()
@ -92,7 +93,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = if (groupCode > 0) Scene.STRANGER_FROM_GROUP else Scene.STRANGER
this.peer = record.senderUin.toString()
this.subPeer = groupCode.toString()
}.build()
@ -115,7 +116,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.GUILD
this.peer = record.guildId ?: ""
this.subPeer = record.channelId ?: ""
}.build()