44 "fmt"
55 "io/ioutil"
66 "strings"
7+ "time"
78
89 "github.com/Mrs4s/MiraiGo/client"
910 "github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
@@ -30,6 +31,7 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err
3031 }
3132 switch rsp .Error {
3233 case client .SliderNeededError :
34+ log .Infof ("遇到滑块验证码,请阅读README(顺便star),根据提示操作 https://github.com/protobufbot/Go-Mirai-Client" )
3335 Captcha = & dto.Captcha {
3436 BotId : cli .Uin ,
3537 CaptchaType : dto .Captcha_SLIDER_CAPTCHA ,
@@ -47,6 +49,7 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err
4749 }
4850 return ProcessLoginRsp (cli , rsp )
4951 case client .NeedCaptcha :
52+ log .Infof ("遇到图形验证码,请阅读README(顺便star),根据提示操作 https://github.com/protobufbot/Go-Mirai-Client" )
5053 _ = ioutil .WriteFile ("captcha.jpg" , rsp .CaptchaImage , 0644 )
5154 Captcha = & dto.Captcha {
5255 BotId : cli .Uin ,
@@ -63,6 +66,7 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err
6366 }
6467 return ProcessLoginRsp (cli , rsp )
6568 case client .SMSNeededError :
69+ log .Infof ("遇到短信验证码,请阅读README(顺便star),根据提示操作 https://github.com/protobufbot/Go-Mirai-Client" )
6670 if ! cli .RequestSMS () {
6771 return false , fmt .Errorf ("请求短信验证码错误,可能是太频繁" )
6872 }
@@ -81,13 +85,16 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err
8185
8286 return ProcessLoginRsp (cli , rsp )
8387 case client .UnsafeDeviceError :
88+ log .Infof ("遇到设备锁扫码验证码,请阅读README(顺便star),根据提示操作 https://github.com/protobufbot/Go-Mirai-Client" )
8489 Captcha = & dto.Captcha {
8590 BotId : cli .Uin ,
8691 CaptchaType : dto .Captcha_UNSAFE_DEVICE_LOGIN_VERIFY ,
8792 Data : & dto.Captcha_Url {Url : rsp .VerifyUrl },
8893 }
8994 CaptchaPromise = promise .NewPromise ()
9095 _ , err := CaptchaPromise .Get ()
96+ cli .Disconnect ()
97+ time .Sleep (3 * time .Second )
9198 rsp , err := cli .Login ()
9299 if err != nil {
93100 return false , fmt .Errorf ("设备锁验证/登陆错误" )
0 commit comments