修改登录接口

This commit is contained in:
Cool 2024-11-05 18:38:23 +08:00
parent f570189652
commit e3c9470b4d
1 changed files with 54 additions and 54 deletions

View File

@ -1,13 +1,15 @@
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"time"
"os"
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
"github.com/eatmoreapple/openwechat"
)
@ -64,12 +66,11 @@ func HttpPost(url string, data interface{}, timelim int) []byte {
func main() {
bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式,上面登录不上的可以尝试切换这种模式
reloadStorage := openwechat.NewJsonFileHotReloadStorage("storage.json")
defer reloadStorage.Close()
bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式
err := bot.PushLogin(reloadStorage, openwechat.NewRetryLoginOption())
if err != nil {
// 注册登陆二维码回调
bot.UUIDCallback = openwechat.PrintlnQrcodeUrl
if err := bot.Login(); err != nil {
fmt.Println(err)
return
}
@ -119,7 +120,6 @@ func main() {
// 调用Stable Diffusion
// msg.ReplyText("这个功能还没有实现,可以先期待一下~")
sender, _ := msg.Sender()
content = strings.TrimLeft(content[len("生成图片"):], " \t\n")
resp_raw := HttpPost("http://localhost:11111/draw", GenerateImageRequest{UserName: sender.ID(), Prompt: content}, 120)