mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 15:17:03 +08:00
Try register only if possible. Close #47
This commit is contained in:
parent
1993047221
commit
a7055ed92d
@ -89,9 +89,13 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
|||||||
}.also { _packetReceiverJob = it }
|
}.also { _packetReceiverJob = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override suspend fun relogin() {
|
override suspend fun relogin() {
|
||||||
if (::channel.isInitialized) {
|
if (::channel.isInitialized) {
|
||||||
|
if (channel.isOpen) {
|
||||||
|
kotlin.runCatching {
|
||||||
|
registerClientOnline()
|
||||||
|
}.exceptionOrNull() ?: return
|
||||||
|
}
|
||||||
channel.close()
|
channel.close()
|
||||||
}
|
}
|
||||||
channel = PlatformSocket()
|
channel = PlatformSocket()
|
||||||
@ -149,10 +153,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// println("d2key=${bot.client.wLoginSigInfo.d2Key.toUHexString()}")
|
// println("d2key=${bot.client.wLoginSigInfo.d2Key.toUHexString()}")
|
||||||
|
registerClientOnline()
|
||||||
|
}
|
||||||
|
|
||||||
repeat(2) {
|
private suspend fun registerClientOnline() {
|
||||||
StatSvc.Register(bot.client).sendAndExpect<StatSvc.Register.Response>(6000) // it's slow
|
StatSvc.Register(bot.client).sendAndExpect<StatSvc.Register.Response>(6000) // it's slow
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseExperimental(MiraiExperimentalAPI::class, ExperimentalTime::class)
|
@UseExperimental(MiraiExperimentalAPI::class, ExperimentalTime::class)
|
||||||
|
Loading…
Reference in New Issue
Block a user