mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
save captcha to local file. close #71
This commit is contained in:
parent
129622dd24
commit
23d436972c
3
main.go
3
main.go
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user