mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-05 03:44:44 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c13109cf5b
@ -31,6 +31,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc
|
||||
import net.mamoe.mirai.utils.*
|
||||
import net.mamoe.mirai.utils.io.*
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.jvm.Volatile
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
@ -130,14 +131,14 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
150,
|
||||
0,
|
||||
0
|
||||
).sendAndExpect<FriendList.GetFriendGroupList.Response>(timeoutMillis = 1000)
|
||||
).sendAndExpect<FriendList.GetFriendGroupList.Response>(timeoutMillis = 5000, retry = 2)
|
||||
|
||||
totalFriendCount = data.totalFriendCount
|
||||
data.friendList.forEach {
|
||||
// atomic add
|
||||
bot.qqs.delegate.addLast(bot.getFriend(it.friendUin).also {
|
||||
bot.qqs.delegate.addLast(QQImpl(bot, bot.coroutineContext, it.friendUin)).also {
|
||||
currentFriendCount++
|
||||
})
|
||||
}
|
||||
}
|
||||
bot.logger.verbose("正在加载好友列表 ${currentFriendCount}/${totalFriendCount}")
|
||||
if (currentFriendCount >= totalFriendCount) {
|
||||
@ -147,7 +148,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}
|
||||
bot.logger.info("好友列表加载完成, 共 ${currentFriendCount}个")
|
||||
} catch (e: Exception) {
|
||||
bot.logger.info("加载好友列表失败|一般这是由于加载过于频繁导致/将以热加载方式加载好友列表")
|
||||
bot.logger.error("加载好友列表失败|一般这是由于加载过于频繁导致/将以热加载方式加载好友列表")
|
||||
}
|
||||
|
||||
val friendLoadFinish = currentTimeMillis
|
||||
@ -156,7 +157,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
bot.logger.info("开始加载群组列表与群成员列表")
|
||||
val troopData = FriendList.GetTroopListSimplify(
|
||||
bot.client
|
||||
).sendAndExpect<FriendList.GetTroopListSimplify.Response>(timeoutMillis = 1000)
|
||||
).sendAndExpect<FriendList.GetTroopListSimplify.Response>(timeoutMillis = 5000)
|
||||
// println("获取到群数量" + troopData.groups.size)
|
||||
val toGet: MutableMap<GroupImpl, ContactList<Member>> = mutableMapOf()
|
||||
troopData.groups.forEach {
|
||||
@ -197,7 +198,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}
|
||||
bot.logger.info("群组列表与群成员加载完成, 共 ${troopData.groups.size}个")
|
||||
} catch (e: Exception) {
|
||||
bot.logger.info("加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表")
|
||||
bot.logger.error("加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表")
|
||||
}
|
||||
|
||||
//===log===//
|
||||
@ -224,7 +225,6 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}
|
||||
bot.logger.info("====================Mirai Bot List初始化完毕====================")
|
||||
return
|
||||
|
||||
MessageSvc.PbGetMsg(bot.client, MsgSvc.SyncFlag.START, currentTimeSeconds).sendWithoutExpect()
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
package net.mamoe.mirai.qqandroid
|
||||
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.header
|
||||
import io.ktor.client.request.headers
|
||||
import io.ktor.client.request.post
|
||||
import io.ktor.client.response.HttpResponse
|
||||
import io.ktor.http.URLProtocol
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.io.readRemaining
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.io.core.readBytes
|
||||
|
||||
|
||||
suspend fun main(){
|
||||
val lst = listOf<String>("N","n","M","m","S","s","L","l","1","2","3","4","5","0")
|
||||
fun rdm(l:Int):String{
|
||||
var s = "Pp";
|
||||
repeat(l){
|
||||
s+=lst.random()
|
||||
}
|
||||
return s
|
||||
}
|
||||
val lst2 = listOf<String>("1","2","3","4","5","6","7")
|
||||
fun rdmQQ(){
|
||||
var s = "1"
|
||||
repeat(8){
|
||||
s+=lst2.random()
|
||||
}
|
||||
}
|
||||
coroutineScope {
|
||||
repeat(1000) {
|
||||
launch {
|
||||
val r = HttpClient().get<HttpResponse>() {
|
||||
url {
|
||||
protocol = URLProtocol.HTTPS
|
||||
host = "papl.lfdevs.com"
|
||||
path("/check/regcheck")
|
||||
parameters["c"] = "reg"
|
||||
parameters["username"] = rdm(12)
|
||||
parameters["email"] = rdm(5) + "@126.com"
|
||||
parameters["pwd"] = rdm(10)
|
||||
parameters["qq"] = rdmQQ().toString()
|
||||
parameters["sex"] = "1"
|
||||
}
|
||||
headers {
|
||||
header("referer","https://papl.lfdevs.com/index/login")
|
||||
header("user-agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36")
|
||||
}
|
||||
}
|
||||
if(r.status.value==200) {
|
||||
println(r.status.toString() + "|" + String(r.content.readRemaining().readBytes()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user