mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-06 17:10:48 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
73d1a3d4d2
@ -73,25 +73,30 @@ internal class MemberImpl(
|
||||
|
||||
|
||||
@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 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 =
|
||||
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 {
|
||||
TODO("not implemented")
|
||||
override suspend fun updateGroupInfo(): net.mamoe.mirai.data.GroupInfo {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
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()
|
||||
@ -112,4 +117,5 @@ internal class GroupImpl(bot: QQAndroidBot, override val coroutineContext: Corou
|
||||
override suspend fun uploadImage(image: ExternalImage): ImageId {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ import net.mamoe.mirai.data.MultiPacket
|
||||
import net.mamoe.mirai.data.Packet
|
||||
import net.mamoe.mirai.event.*
|
||||
import net.mamoe.mirai.network.BotNetworkHandler
|
||||
import net.mamoe.mirai.qqandroid.GroupImpl
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
import net.mamoe.mirai.qqandroid.QQImpl
|
||||
import net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
|
||||
@ -148,11 +149,14 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}
|
||||
|
||||
try {
|
||||
bot.logger.info("开始加载组列表")
|
||||
bot.logger.info("开始加载群组列表")
|
||||
val troopData = FriendList.GetTroopListSimplify(
|
||||
bot.client
|
||||
).sendAndExpect<FriendList.GetTroopListSimplify.Response>(timeoutMillis = 1000)
|
||||
println(troopData.contentToString())
|
||||
troopData.groups.forEach {
|
||||
bot.groups.delegate.addLast(GroupImpl(bot, EmptyCoroutineContext, it.groupUin))
|
||||
}
|
||||
bot.logger.info("群组列表加载完成, 共 ${troopData.groups.size}个")
|
||||
} catch (e: Exception) {
|
||||
bot.logger.info("加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表")
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.coerceAtLeastOrFail
|
||||
* - Group ID([Group.internalId]) 是与调用 API 时使用的 id.(在 QQ 客户端中不可见)
|
||||
* @author Him188moe
|
||||
*/
|
||||
interface Group : Contact, CoroutineScope/*, Map<UInt, Member>*/ { // TODO: 2020/1/29 实现接口 Map<Long, Memebr>
|
||||
interface Group : Contact, CoroutineScope {
|
||||
/**
|
||||
* 内部 ID. 内部 ID 为 [GroupId] 的映射
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user