Commit 0d1dfeef authored by wdvxdr1123's avatar wdvxdr1123 Committed by GitHub

Merge

Dev
parents 2e59cb8a d4385437
......@@ -268,6 +268,28 @@ Type: `cardimage`
| group_id | int64 | 群号 |
| group_name | string | 新名 |
### 设置群头像
终结点: `/set_group_portrait`
**参数**
| 字段 | 类型 | 说明 |
| -------- | ------ | ---- |
| group_id | int64 | 群号 |
| file | string | 图片文件名 |
| cache | int | 表示是否使用已缓存的文件 |
[1]`file` 参数支持以下几种格式:
- 绝对路径,例如 `file:///C:\\Users\Richard\Pictures\1.png`,格式使用 [`file` URI](https://tools.ietf.org/html/rfc8089)
- 网络 URL,例如 `http://i1.piimg.com/567571/fdd6e7b6d93f1ef0.jpg`
- Base64 编码,例如 `base64://iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAIAAADJt1n/AAAAKElEQVQ4EWPk5+RmIBcwkasRpG9UM4mhNxpgowFGMARGEwnBIEJVAAAdBgBNAZf+QAAAAABJRU5ErkJggg==`
[2]`cache`参数: 通过网络 URL 发送时有效,`1`表示使用缓存,`0`关闭关闭缓存,默认 为`1`
[3] 目前这个API在登录一段时间后因cookie失效而失效,请考虑后使用
### 获取图片信息
终结点: `/get_image`
......
......@@ -53,7 +53,7 @@ func IsAMRorSILK(b []byte) bool {
}
func FindFile(f, cache, PATH string) (data []byte, err error) {
data, err = nil, errors.New("can't find the file: "+f)
data, err = nil, errors.New("syntax error")
if strings.HasPrefix(f, "http") || strings.HasPrefix(f, "https") {
if cache == "" {
cache = "1"
......@@ -74,7 +74,8 @@ func FindFile(f, cache, PATH string) (data []byte, err error) {
return nil, err
}
} else if strings.HasPrefix(f, "file") {
fu, err := url.Parse(f)
var fu *url.URL
fu, err = url.Parse(f)
if err != nil {
return nil, err
}
......
......@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-20200928082341-65c1709f5eec
github.com/Mrs4s/MiraiGo v0.0.0-20200929101232-fbb53eba9b5a
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.3.0 // indirect
......
......@@ -2,6 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Mrs4s/MiraiGo v0.0.0-20200928082341-65c1709f5eec h1:lzFAr6b1yO6JIzfse0VIsPq71E0KfdsoS3VnyOLurS4=
github.com/Mrs4s/MiraiGo v0.0.0-20200928082341-65c1709f5eec/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-20200929101232-fbb53eba9b5a h1:MaKFlcVI0aW7PFMrxpv2UBmvMGqKsiQP3O9j5wtVYYg=
github.com/Mrs4s/MiraiGo v0.0.0-20200929101232-fbb53eba9b5a/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
......
......@@ -303,10 +303,14 @@ func main() {
var times uint = 1
for {
if conf.ReLogin.MaxReloginTimes == 0 {
} else if times > conf.ReLogin.MaxReloginTimes {
if cli.Online {
log.Warn("Bot已登录")
return
}
if conf.ReLogin.MaxReloginTimes != 0 && times > conf.ReLogin.MaxReloginTimes {
break
}
log.Warnf("Bot已离线 (%v),将在 %v 秒后尝试重连. 重连次数:%v",
e.Message, conf.ReLogin.ReLoginDelay, times)
times++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment