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
2c8d941c
Commit
2c8d941c
authored
Jul 23, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc update.
parent
feb4ff4a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
160 additions
and
3 deletions
+160
-3
coolq/api.go
coolq/api.go
+3
-3
docs/config.md
docs/config.md
+44
-0
docs/cqhttp.md
docs/cqhttp.md
+72
-0
docs/file.md
docs/file.md
+38
-0
docs/quick_start.md
docs/quick_start.md
+3
-0
No files found.
coolq/api.go
View file @
2c8d941c
...
@@ -240,9 +240,9 @@ func (bot *CQBot) CQGetImage(file string) MSG {
...
@@ -240,9 +240,9 @@ func (bot *CQBot) CQGetImage(file string) MSG {
r
:=
binary
.
NewReader
(
b
)
r
:=
binary
.
NewReader
(
b
)
r
.
ReadBytes
(
16
)
r
.
ReadBytes
(
16
)
return
OK
(
MSG
{
return
OK
(
MSG
{
"size"
:
r
.
ReadInt32
(),
"size"
:
r
.
ReadInt32
(),
"filename
s
"
:
r
.
ReadString
(),
"filename"
:
r
.
ReadString
(),
"url"
:
r
.
ReadString
(),
"url"
:
r
.
ReadString
(),
})
})
}
}
return
Failed
(
100
)
return
Failed
(
100
)
...
...
docs/config.md
0 → 100644
View file @
2c8d941c
# 配置
go-cqhttp 包含
`config.json`
和
`device.json`
两个配置文件, 其中
`config.json`
为运行配置
`device.json`
为虚拟设备信息.
## 从原CQHTTP导入配置
go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
1.
找到CQHTTP原配置文件
`{CQ工作目录}/app/io.github.richardchien.coolqhttpapi/config/{qq号}.json`
2.
将文件复制到go-cqhttp根目录并重命名为
`cqhttp.json`
3.
重启go-cqhttp后将自动导入配置
## 配置信息
默认生成的配置文件如下所示:
````
json
{
"uin"
:
0
,
"password"
:
""
,
"enable_db"
:
true
,
"access_token"
:
""
,
"http_config"
:
{
"enabled"
:
true
,
"host"
:
"0.0.0.0"
,
"port"
:
5700
},
"ws_config"
:
{
"enabled"
:
true
,
"host"
:
"0.0.0.0"
,
"port"
:
6700
}
}
````
| 字段 | 类型 | 说明 |
| ------------ | ------ | ------------------------------------------------------------ |
| uin | int64 | 登录用QQ号 |
| password | string | 登录用密码 |
| enable_db | bool | 是否开启内置数据库, 关闭后将无法使用
**回复/撤回**
等上下文相关接口 |
| access_token | string | 同CQHTTP的
`access_token`
用于身份验证 |
| http_config | object | HTTP API配置 |
| ws_config | object | Websocket API 配置 |
docs/cqhttp.md
0 → 100644
View file @
2c8d941c
# 拓展API
由于部分 api 原版 CQHTTP 并未实现,go-cqhttp 修改并增加了一些拓展 api .
## CQCode
| Code | 示例 | 说明 |
| ----- | -------------------- | ---------------------------------------------------------- |
| reply | [CQ:reply,id=123456] | 回复ID为
`123456`
的信息. 发送时一条
`message`
仅能使用一次 |
## API
`/set_group_name`
**设置群名**
**参数**
| 字段 | 类型 | 说明 |
| -------- | ------ | ---- |
| group_id | int64 | 群号 |
| name | string | 新名 |
`/get_image`
**获取图片信息**
> 该接口为 CQHTTP 接口修改
参数
| 字段 | 类型 | 说明 |
| ------ | ------ | -------------- |
|
`file`
| string | 图片缓存文件名 |
响应数据
| 字段 | 类型 | 说明 |
| ---------- | ------ | -------------- |
|
`size`
| int32 | 图片源文件大小 |
|
`filename`
| string | 图片文件原名 |
|
`url`
| string | 图片下载地址 |
`/get_group_msg`
**获取群消息**
参数
| 字段 | 类型 | 说明 |
| ------------ | ----- | ------ |
|
`message_id`
| int32 | 消息id |
响应数据
| 字段 | 类型 | 说明 |
| ------------ | ------- | ---------- |
|
`message_id`
| int32 | 消息id |
|
`real_id`
| int32 | 消息真实id |
|
`sender`
| object | 发送者 |
|
`time`
| int32 | 发送时间 |
|
`content`
| message | 消息内容 |
## 事件
#### 群消息撤回
**上报数据**
| 字段 | 类型 | 可能的值 | 说明 |
| ------------- | ------ | -------------- | -------------- |
|
`post_type`
| string |
`notice`
| 上报类型 |
|
`notice_type`
| string |
`group_recall`
| 消息类型 |
|
`group_id`
| int64 | | 群号 |
|
`user_id`
| int64 | | 消息发送者id |
|
`operator_id`
| int64 | | 操作者id |
|
`message_id`
| int64 | | 被撤回的消息id |
docs/file.md
0 → 100644
View file @
2c8d941c
# 文件
go-cqhttp 默认生成的文件树如下所示:
````
.
├── go-cqhttp
├── config.json
├── device.json
├── logs
│ └── xx-xx-xx.log
└── data
├── images
│ └── xxxx.image
└── db
````
| 文件 | 用途 |
| ----------- | ------------------- |
| go-cqhttp | go-cqhttp可执行文件 |
| config.json | 运行配置文件 |
| device.json | 虚拟设备配置文件 |
| logs | 日志存放目录 |
| data | 数据目录 |
| data/images | 图片缓存目录 |
| data/db | 数据库目录 |
## 图片缓存文件
出于性能考虑,go-cqhttp 并不会将图片源文件下载到本地,而是生成一个可以和QQ服务器对应的缓存文件 (.image),该缓存文件结构如下:
| 偏移 | 类型 | 说明 |
| --------------- | -------- | ------------------ |
| 0x00 | [16]byte | 图片源文件MD5 HASH |
| 0x10 | uint32 | 图片源文件大小 |
| 0x14 | string | 图片原名(QQ内部ID) |
| 0x14 + 原名长度 | string | 图片下载链接 |
docs/quick_start.md
0 → 100644
View file @
2c8d941c
# 开始
欢迎来到 go-cqhttp 文档
\ No newline at end of file
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