Troop Member List

This commit is contained in:
jiahua.liu 2020-02-02 20:11:41 +08:00
parent 7de51f995c
commit 0d4850591c
2 changed files with 20 additions and 14 deletions

View File

@ -73,25 +73,30 @@ internal class MemberImpl(
@UseExperimental(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal class GroupImpl(bot: QQAndroidBot, override val coroutineContext: CoroutineContext, override val id: Long) : ContactImpl(), Group { internal class GroupImpl(
bot: QQAndroidBot, override val coroutineContext: CoroutineContext, override val id: Long,
override val owner: Member,
override val name: String,
override val announcement: String,
override val members: ContactList<Member>
) : ContactImpl(), Group {
override val internalId: GroupInternalId = GroupId(id).toInternalId() override val internalId: GroupInternalId = GroupId(id).toInternalId()
override val owner: Member
get() = TODO("not implemented")
override val name: String
get() = TODO("not implemented")
override val announcement: String
get() = TODO("not implemented")
override val members: ContactList<Member> = ContactList(LockFreeLinkedList())
override fun getMember(id: Long): Member = override fun getMember(id: Long): Member =
members.delegate.filteringGetOrAdd({ it.id == id }, { MemberImpl(bot.getQQ(id) as QQImpl, this, coroutineContext) }) members.delegate.filteringGetOrAdd(
{ it.id == id },
{ MemberImpl(bot.getQQ(id) as QQImpl, this, coroutineContext) })
override suspend fun updateGroupInfo(): GroupInfo { override suspend fun updateGroupInfo(): net.mamoe.mirai.data.GroupInfo {
TODO("not implemented") TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
override suspend fun quit(): Boolean { override suspend fun quit(): Boolean {
TODO("not implemented") TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
operator fun get(key: Long): Member? {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
override val bot: QQAndroidBot by bot.unsafeWeakRef() override val bot: QQAndroidBot by bot.unsafeWeakRef()
@ -112,4 +117,5 @@ internal class GroupImpl(bot: QQAndroidBot, override val coroutineContext: Corou
override suspend fun uploadImage(image: ExternalImage): ImageId { override suspend fun uploadImage(image: ExternalImage): ImageId {
TODO("not implemented") TODO("not implemented")
} }
} }

View File

@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.coerceAtLeastOrFail
* - Group ID([Group.internalId]) 是与调用 API 时使用的 id.( QQ 客户端中不可见) * - Group ID([Group.internalId]) 是与调用 API 时使用的 id.( QQ 客户端中不可见)
* @author Him188moe * @author Him188moe
*/ */
interface Group : Contact, CoroutineScope/*, Map<UInt, Member>*/ { // TODO: 2020/1/29 实现接口 Map<Long, Memebr> interface Group : Contact, CoroutineScope {
/** /**
* 内部 ID. 内部 ID [GroupId] 的映射 * 内部 ID. 内部 ID [GroupId] 的映射
*/ */
@ -101,4 +101,4 @@ fun Long.groupId(): GroupId = GroupId(this.coerceAtLeastOrFail(0))
* @see GroupInternalId.toId [GroupInternalId] 转换为 [GroupId] * @see GroupInternalId.toId [GroupInternalId] 转换为 [GroupId]
* @see GroupId.toInternalId [GroupId] 转换为 [GroupInternalId] * @see GroupId.toInternalId [GroupId] 转换为 [GroupInternalId]
*/ */
inline class GroupInternalId(inline val value: Long) inline class GroupInternalId(inline val value: Long)