1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

save captcha to local file. close #71

This commit is contained in:
Mrs4s 2020-08-11 17:35:03 +08:00
parent 129622dd24
commit 23d436972c

View File

@ -166,9 +166,10 @@ func main() {
if !rsp.Success {
switch rsp.Error {
case client.NeedCaptcha:
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0677)
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
fmt.Println(asciiart.New("image", img).Art)
log.Warn("请输入验证码 (Enter 提交)")
log.Warn("请输入验证码 (captcha.jpg) (Enter 提交)")
text, _ := console.ReadString('\n')
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
continue