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 {
|
if !rsp.Success {
|
||||||
switch rsp.Error {
|
switch rsp.Error {
|
||||||
case client.NeedCaptcha:
|
case client.NeedCaptcha:
|
||||||
|
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0677)
|
||||||
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
|
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
|
||||||
fmt.Println(asciiart.New("image", img).Art)
|
fmt.Println(asciiart.New("image", img).Art)
|
||||||
log.Warn("请输入验证码: (Enter 提交)")
|
log.Warn("请输入验证码 (captcha.jpg): (Enter 提交)")
|
||||||
text, _ := console.ReadString('\n')
|
text, _ := console.ReadString('\n')
|
||||||
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
|
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user