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
data class MemberDTO(
override val id: Long,
val memberName: String = "",
val memberName: String,
val permission: MemberPermission,
val group: GroupDTO
) : ContactDTO() {
constructor(member: Member, name: String = "") : this (
member.id, name, member.permission, GroupDTO(member.group)
constructor(member: Member) : this (
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) {
is FriendMessage -> FriendMessagePacketDTO(QQDTO(sender))
is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender, senderName))
is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender))
else -> UnKnownMessagePacketDTO("UnKnown Message Packet")
}.apply { messageChain = Array(message.size){ message[it].toDTO() }}