Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
0d1dfeef
Commit
0d1dfeef
authored
Oct 01, 2020
by
wdvxdr1123
Committed by
GitHub
Oct 01, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge
Dev
parents
2e59cb8a
d4385437
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
5 deletions
+34
-5
docs/cqhttp.md
docs/cqhttp.md
+22
-0
global/fs.go
global/fs.go
+3
-2
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
main.go
main.go
+6
-2
No files found.
docs/cqhttp.md
View file @
0d1dfeef
...
...
@@ -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`
...
...
global/fs.go
View file @
0d1dfeef
...
...
@@ -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
}
...
...
go.mod
View file @
0d1dfeef
...
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-2020092
8082341-65c1709f5eec
github.com/Mrs4s/MiraiGo v0.0.0-2020092
9101232-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
...
...
go.sum
View file @
0d1dfeef
...
...
@@ -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=
...
...
main.go
View file @
0d1dfeef
...
...
@@ -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
++
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment