Add configurations for captcha

This commit is contained in:
Him188 2019-11-26 12:10:40 +08:00
parent a0f170ccba
commit f9986ffb44
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.packet.login.LoginResult.Companion.SUCCESS
import net.mamoe.mirai.utils.BotConfiguration
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@ -72,6 +73,12 @@ inline class LoginResult(val id: Byte) {
@JvmStatic
val NETWORK_UNAVAILABLE = LoginResult(9)
/**
* 需要验证码且 [BotConfiguration.failOnCaptcha] `true`
*/
@JvmStatic
val CAPTCHA = LoginResult(10)
@JvmStatic
val values: List<LoginResult> by lazy {
listOf(

View File

@ -42,7 +42,10 @@ class BotConfiguration {
* 一旦心跳超时, 整个网络服务将会重启 (将消耗约 1s). 除正在进行的任务 (如图片上传) 会被中断外, 事件和插件均不受影响.
*/
var heartbeatTimeout: TimeSpan = 2.seconds
/**
* 有验证码要求就失败
*/
var failOnCaptcha = false
/**
* 验证码处理器
*/