Async friendlist

This commit is contained in:
Him188 2020-02-03 13:30:06 +08:00
parent 8c69eefcde
commit 102da76a32

View File

@ -180,7 +180,9 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
toGet[group] = contactList
bot.groups.delegate.addLast(group)
}
coroutineScope {
toGet.forEach {
launch {
try {
getTroopMemberList(it.key, it.value, it.key.owner.id)
groupInfo[it.key.uin] = it.value.size
@ -188,8 +190,10 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
groupInfo[it.key.uin] = -1
bot.logger.info("${it.key.uin}的列表拉取失败, 将采用动态加入")
}
}
//delay(200)
}
}
bot.logger.info("群组列表与群成员加载完成, 共 ${troopData.groups.size}")
} catch (e: Exception) {
bot.logger.info("加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表")
@ -218,6 +222,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
}
bot.logger.info("====================Mirai Bot List初始化完毕====================")
return
MessageSvc.PbGetMsg(bot.client, MsgSvc.SyncFlag.START, currentTimeSeconds).sendWithoutExpect()
}