mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
fix timeout.
This commit is contained in:
parent
f96abc5e26
commit
ce0a5b0271
@ -8,15 +8,20 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var client = &http.Client{
|
||||
Timeout: time.Second * 15,
|
||||
}
|
||||
|
||||
func GetBytes(url string) ([]byte, error) {
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header["User-Agent"] = []string{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 Edg/83.0.478.61"}
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ func (c *httpClient) onBotPushEvent(m coolq.MSG) {
|
||||
log.Warnf("上报Event数据 %v 到 %v 失败: %v", m.ToJson(), c.addr, err)
|
||||
return
|
||||
}
|
||||
log.Debugf("上报Event数据 %v 到 %v", m.ToJson(), c.addr)
|
||||
if gjson.Valid(res) {
|
||||
c.bot.CQHandleQuickOperation(gjson.Parse(m.ToJson()), gjson.Parse(res))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user