Fix missing group owner

This commit is contained in:
Him188 2019-12-04 20:43:54 +08:00
parent f3f8be5fb6
commit c2d89b611a

View File

@ -40,18 +40,17 @@ data class RawGroupInfo(
val name: String, val name: String,
val announcement: String, val announcement: String,
/** /**
* 含群主 * 含群主
*/ */
val members: Map<UInt, MemberPermission> val members: Map<UInt, MemberPermission>
) : GroupPacket.GroupPacketResponse { ) : GroupPacket.GroupPacketResponse {
suspend inline fun parseBy(group: Group): GroupInfo = group.bot.withSession { suspend inline fun parseBy(group: Group): GroupInfo = group.bot.withSession {
GroupInfo( return GroupInfo(
group, group,
MemberImpl(this@RawGroupInfo.owner.qq(), group, MemberPermission.OWNER), MemberImpl(this@RawGroupInfo.owner.qq(), group, MemberPermission.OWNER),
this@RawGroupInfo.name, this@RawGroupInfo.name,
this@RawGroupInfo.announcement, this@RawGroupInfo.announcement,
ContactList(this@RawGroupInfo.members.mapValuesTo(MutableContactList<Member>()) { MemberImpl(it.key.qq(), group, it.value) } ContactList(this@RawGroupInfo.members.mapValuesTo(MutableContactList()) { MemberImpl(it.key.qq(), group, it.value) })
.apply { put(owner, MemberImpl(owner.qq(), group, MemberPermission.OWNER)) })
) )
} }
} }
@ -207,6 +206,7 @@ object GroupPacket : SessionPacketFactory<GroupPacket.GroupPacketResponse>() {
} }
members[qq] = permission members[qq] = permission
} while (qq != stop && remaining != 0L) } while (qq != stop && remaining != 0L)
members[owner] = MemberPermission.OWNER
return RawGroupInfo(group, owner, groupName, announcement, members) return RawGroupInfo(group, owner, groupName, announcement, members)
/* /*
* Mirai * Mirai