http-api use member group card instead of sender name

This commit is contained in:
ryoii 2020-02-07 15:22:50 +08:00
parent fa515ed3b9
commit 75d82457ea
2 changed files with 4 additions and 4 deletions

View File

@ -25,12 +25,12 @@ data class QQDTO(
@Serializable @Serializable
data class MemberDTO( data class MemberDTO(
override val id: Long, override val id: Long,
val memberName: String = "", val memberName: String,
val permission: MemberPermission, val permission: MemberPermission,
val group: GroupDTO val group: GroupDTO
) : ContactDTO() { ) : ContactDTO() {
constructor(member: Member, name: String = "") : this ( constructor(member: Member) : this (
member.id, name, member.permission, GroupDTO(member.group) member.id, member.groupCard, member.permission, GroupDTO(member.group)
) )
} }

View File

@ -64,7 +64,7 @@ sealed class MessageDTO : DTO
*/ */
suspend fun MessagePacket<*, *>.toDTO(): MessagePacketDTO = when (this) { suspend fun MessagePacket<*, *>.toDTO(): MessagePacketDTO = when (this) {
is FriendMessage -> FriendMessagePacketDTO(QQDTO(sender)) is FriendMessage -> FriendMessagePacketDTO(QQDTO(sender))
is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender, senderName)) is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender))
else -> UnKnownMessagePacketDTO("UnKnown Message Packet") else -> UnKnownMessagePacketDTO("UnKnown Message Packet")
}.apply { messageChain = Array(message.size){ message[it].toDTO() }} }.apply { messageChain = Array(message.size){ message[it].toDTO() }}