From 05eb88e556177dc1cb29dc11bcdd499c57deeede Mon Sep 17 00:00:00 2001 From: "jiahua.liu" Date: Sun, 2 Feb 2020 18:10:35 +0800 Subject: [PATCH] Troop List complete --- .../mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt index 42e29a2f7..e0862f25e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt @@ -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(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("加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表") }