mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 04:50:26 +08:00
Fix #428
This commit is contained in:
parent
58908d60b2
commit
0a7ebffd95
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network
@ -24,6 +24,7 @@ import net.mamoe.mirai.event.events.BotOfflineEvent
|
||||
import net.mamoe.mirai.event.events.BotOnlineEvent
|
||||
import net.mamoe.mirai.event.events.BotReloginEvent
|
||||
import net.mamoe.mirai.message.MessageEvent
|
||||
import net.mamoe.mirai.network.RetryLaterException
|
||||
import net.mamoe.mirai.network.UnsupportedSMSLoginException
|
||||
import net.mamoe.mirai.network.WrongPasswordException
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
@ -176,8 +177,12 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
}
|
||||
}
|
||||
|
||||
is WtLogin.Login.LoginPacketResponse.Error ->
|
||||
is WtLogin.Login.LoginPacketResponse.Error -> {
|
||||
if (response.message.contains("0x9a")) { //Error(title=登录失败, message=请你稍后重试。(0x9a), errorInfo=)
|
||||
throw RetryLaterException()
|
||||
}
|
||||
throw WrongPasswordException(response.toString())
|
||||
}
|
||||
|
||||
is WtLogin.Login.LoginPacketResponse.DeviceLockLogin -> {
|
||||
response = WtLogin.Login.SubCommand20(
|
||||
|
@ -13,6 +13,8 @@ package net.mamoe.mirai.network
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
/**
|
||||
* 在 [登录][Bot.login] 失败时抛出, 可正常地中断登录过程.
|
||||
@ -29,17 +31,24 @@ sealed class LoginFailedException constructor(
|
||||
/**
|
||||
* 密码输入错误 (有时候也会是其他错误, 如 `"当前上网环境异常,请更换网络环境或在常用设备上登录或稍后再试。"`)
|
||||
*/
|
||||
class WrongPasswordException(message: String?) : LoginFailedException(true, message)
|
||||
class WrongPasswordException @MiraiInternalAPI constructor(message: String?) : LoginFailedException(true, message)
|
||||
|
||||
/**
|
||||
* 无可用服务器
|
||||
*/
|
||||
class NoServerAvailableException(override val cause: Throwable?) : LoginFailedException(false, "no server available")
|
||||
class NoServerAvailableException @MiraiInternalAPI constructor(override val cause: Throwable?) :
|
||||
LoginFailedException(false, "no server available")
|
||||
|
||||
/**
|
||||
* 服务器要求稍后重试
|
||||
*/
|
||||
@SinceMirai("1.2.0")
|
||||
class RetryLaterException @MiraiInternalAPI constructor() : LoginFailedException(false, "server requests retrial later")
|
||||
|
||||
/**
|
||||
* 无标准输入或 Kotlin 不支持此输入.
|
||||
*/
|
||||
class NoStandardInputForCaptchaException(override val cause: Throwable?) :
|
||||
class NoStandardInputForCaptchaException @MiraiInternalAPI constructor(override val cause: Throwable?) :
|
||||
LoginFailedException(true, "no standard input for captcha")
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user