[Fix] 🐛 BingAPI Init nil Pointer #406

This commit is contained in:
Harry-zklcdc 2024-04-29 15:47:36 +08:00
parent cfd8d3b1bf
commit c29d6b35b3

View File

@ -23,11 +23,13 @@ func init() {
common.Logger.Info("APIKEY: %s", apikey)
}
go func() {
globalChat = binglib.NewChat("").SetBingBaseUrl("http://localhost:" + common.PORT).SetSydneyBaseUrl("ws://localhost:" + common.PORT).SetBypassServer(common.BypassServer)
globalImage = binglib.NewImage("").SetBingBaseUrl("http://localhost:" + common.PORT).SetBypassServer(common.BypassServer)
time.Sleep(200 * time.Millisecond)
t, _ := getCookie("", "", "")
common.Logger.Info("BingAPI Ready!")
globalChat = binglib.NewChat(t).SetBingBaseUrl("http://localhost:" + common.PORT).SetSydneyBaseUrl("ws://localhost:" + common.PORT).SetBypassServer(common.BypassServer)
globalImage = binglib.NewImage(t).SetBingBaseUrl("http://localhost:" + common.PORT).SetBypassServer(common.BypassServer)
globalChat.SetCookies(t)
globalImage.SetCookies(t)
}()
}