Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta453 #452

Merged
merged 8 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docs/api介绍.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
目前支持的API列表

具体api的定义请参考[onebot-11](https://github.com/botuniverse/onebot-11)

### 支持的API列表

1. `/avatar` - avatar.go
2. `/delete_msg` - delete_msg.go
3. `/get_avatar` - get_avatar.go
4. `/get_friend_list` - get_friend_list.go
5. `/get_group_info` - get_group_info.go
6. `/get_group_list` - get_group_list.go
7. `/get_group_member_info` - get_group_member_info.go
8. `/get_group_member_list` - get_group_member_list.go
9. `/get_guild_channel_list` - get_guild_channel_list.go
10. `/get_guild_list` - get_guild_list.go
11. `/get_guild_service_profile` - get_guild_service_profile.go
12. `/get_login_info` - get_login_info.go
13. `/get_online_clients` - get_online_clients.go
14. `/get_status` - get_status.go
15. `/get_version_info` - get_version_info.go
16. `/handle_quick_operation` - handle_quick_operation.go
17. `/handle_quick_operation_async` - handle_quick_operation_async.go
18. `/mark_msg_as_read` - mark_msg_as_read.go
19. `/message_parser` - message_parser.go
20. `/put_interaction` - put_interaction.go
21. `/send_group_forward_msg` - send_group_forward_msg.go
22. `/send_group_msg` - send_group_msg.go
23. `/send_group_msg_async` - send_group_msg_async.go
24. `/send_group_msg_raw` - send_group_msg_raw.go
25. `/send_guild_channel_forum` - send_guild_channel_forum.go
26. `/send_guild_channel_msg` - send_guild_channel_msg.go
27. `/send_guild_private_msg` - send_guild_private_msg.go
28. `/send_msg` - send_msg.go
29. `/send_msg_async` - send_msg_async.go
30. `/send_private_msg` - send_private_msg.go
31. `/send_private_msg_async` - send_private_msg_async.go
32. `/send_private_msg_sse` - send_private_msg_sse.go
33. `/set_group_ban` - set_group_ban.go
34. `/set_group_whole_ban` - set_group_whole_ban.go
17 changes: 17 additions & 0 deletions docs/api差异-delete_msg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# API: delete_msg

撤回消息。

## 参数

| 字段名 | 数据类型 | 默认值 | 说明 |
|-------------|----------------|--------|-----------------------------------|
| message_id | number (int32) | - | 消息 ID |
| user_id | number | - | 对方 QQ 号(消息类型为 private 时需要) |
| group_id | number | - | 群号(消息类型为 group 时需要) |
| channel_id | number | - | 频道号(消息类型是 guild 时需要) |
| guild_id | number | - | 子频道号(消息类型是 guild_Private 时需要) |

## 响应数据

54 changes: 54 additions & 0 deletions docs/文档-markdown message segment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
```markdown
# Gensokyo Markdown Segment

Gensokyo的Markdown Segment是对现有OneBot v11的扩展。

## Markdown卡片(文本形式)

```json
{
"type": "markdown",
"data": {
"data": "文本内容"
}
}
```

| 参数名 | 收 | 发 | 可能的值 | 说明 |
|----------|----|----|----------|-------------|
| data | ✓ | ✓ | - | md文本 |

**文本内容为**:
- [链接](https://www.yuque.com/km57bt/hlhnxg/ddkv4a2lgcswitei) 中markdown的json字符串的base64(以base64://开头,文字处理为/u形式的unicode)或按以下规则处理后的,json实体化文本。

**转义**:
CQ 码由字符 [ 起始, 以 ] 结束, 并且以 , 分割各个参数。如果你的 CQ 码中, 参数值包括了这些字符, 那么它们应该被使用 HTML 特殊字符的编码方式进行转义。

字符 | 对应实体转义序列
-----|------------------
& | &
[ | [
] | ]
, | ,

## Markdown卡片(object形式)

```json
{
"type": "markdown",
"data": {
"data": md object
}
}
```

| 参数名 | 收 | 发 | 可能的值 | 说明 |
|----------|----|----|----------|-------------|
| data | ✓ | ✓ | - | md object |

**结构请参考**:
支持MessageSegment [链接](https://www.yuque.com/km57bt/hlhnxg/ddkv4a2lgcswitei) 与文本形式实际包含内容相同,但传参类型不同,不是string,而是你所组合的md卡片object(map)。

data下层应包含data(2层data),data.markdown,data.keyboard。
同时与type同级的data字段是OneBot v11标准固定的,所以json结构会呈现data.data.markdown,data.data.keyboard双层结构。
```
167 changes: 167 additions & 0 deletions docs/文档-markdown定义.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
```markdown
## md cq码/segment格式

### CQ码格式

```markdown
[CQ:markdown,data=xxx]
```

推荐使用模板:[链接到模板](https://github.com/hoshinonyaruko/gensokyo-qqmd)

- `data,xxx` 是经过base64编码的JSON数据,支持与其他CQ码拼接,可以组合成message segment形式。

官方文档:[开发者文档](https://bot.q.qq.com/wiki/develop)

新文档:[API v2文档](https://bot.q.qq.com/wiki/develop/api-v2/)

### 自定义md格式

```json
{
"markdown": {
"content": "你好"
},
"keyboard": {
"content": {
"rows": [
{
"buttons": [
{
"render_data": {
"label": "再来一张",
"visited_label": "正在绘图",
"style": 1
},
"action": {
"type": 2,
"permission": {
"type": 2,
"specify_role_ids": [
"1",
"2",
"3"
]
},
"click_limit": 10,
"unsupport_tips": "编辑-兼容文本",
"data": "你好",
"at_bot_show_channel_list": false
}
}
]
}
]
}
},
"msg_id": "123",
"timestamp": "123",
"msg_type": 2
}
```

### 模板md格式

```json
{
"markdown": {
"custom_template_id": "101993071_1658748972",
"params": [
{
"key": "text",
"values": ["标题"]
},
{
"key": "image",
"values": [
"https://resource5-1255303497.cos.ap-guangzhou.myqcloud.com/abcmouse_word_watch/other/mkd_img.png"
]
}
]
},
"keyboard": {
"content": {
"rows": [
{
"buttons": [
{
"render_data": {
"label": "再来一次",
"visited_label": "再来一次"
},
"action": {
"type": 1,
"permission": {
"type": 1,
"specify_role_ids": [
"1",
"2",
"3"
]
},
"click_limit": 10,
"unsupport_tips": "兼容文本",
"data": "data",
"at_bot_show_channel_list": true
}
}
]
}
]
}
}
}
```

### 按钮格式

```json
{
"keyboard": {
"id": 1,
"rows": [
{
"buttons": [
{
"render_data": {
"label": "再来一次",
"visited_label": "再来一次"
},
"action": {
"type": 1,
"permission": {
"type": 1,
"specify_role_ids": [
"1",
"2",
"3"
]
},
"click_limit": 10,
"unsupport_tips": "兼容文本",
"data": "data",
"at_bot_show_channel_list": true
}
}
]
}
]
}
}
```

### 图文混排格式

```markdown
{{.text}}![{{.image_info}}]({{.image_url}})
```

![{{.image_info}}]({{.image_url}}){{.text}}

注意:在`{{}}`中不可以使用`![]()`这种Markdown格式的关键字。

![text #208px #320px](https://xxxxx.png)
```

详细文档请参考:[发消息含有消息按钮组件的消息](https://bot.q.qq.com/wiki/develop/api/openapi/message/post_keyboard_messages.html#%E5%8F%91%E9%80%81%E5%90%AB%E6%9C%89%E6%B6%88%E6%81%AF%E6%8C%89%E9%92%AE%E7%BB%84%E4%BB%B6%E7%9A%84%E6%B6%88%E6%81%AF)
```
2 changes: 2 additions & 0 deletions docs/更多文档.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
文档陆续迁移中,更多文档可查看
[yuque](https://www.yuque.com/km57bt/hlhnxg/mw7gm8dlpccd324e)
56 changes: 56 additions & 0 deletions docs/起步-注册QQ开放平台&启动gensokyo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
```markdown
# 创建QQ机器人并配置

首先,您需要在 [QQ开放平台](https://q.qq.com/qqbot/) 注册一个开发者账号,确保使用您的大号QQ进行注册,而非小号。

## 注册步骤

1. 登录 QQ 开放平台,使用大号QQ注册账号。
2. 注册完成后,进入开发者控制台。

## 创建机器人

根据 [图文版教程](https://www.yuque.com/km57bt/hlhnxg/hoxlh53gg11h7r3l) 中的指导操作,创建您的机器人,并进行必要的配置。

## 设置Intent

根据您的频道类型选择合适的Intent设置:

### 私域频道

```yaml
text_intent:
- DirectMessageHandler
- CreateMessageHandler
- InteractionHandler
- GroupATMessageEventHandler
- C2CMessageEventHandler
- GroupMsgRejectHandler
- GroupMsgReceiveHandler
- GroupAddRobotEventHandler
- GroupDelRobotEventHandler
```

### 公域频道

```yaml
text_intent:
- DirectMessageHandler
- ATMessageEventHandler
- InteractionHandler
- GroupATMessageEventHandler
- C2CMessageEventHandler
- GroupMsgRejectHandler
- GroupMsgReceiveHandler
- GroupAddRobotEventHandler
- GroupDelRobotEventHandler
```

确保按照上述格式将Intent配置正确,这将确保机器人能够正确地处理消息和事件。

## 连接nb2和koishi

完成上述基础配置后,您可以继续学习如何使用nb2和koishi等应用程序来开发您的自定义插件。

现在,您已经完成了基础配置和必要的设置,可以开始进行进一步的开发和集成了。
```
27 changes: 27 additions & 0 deletions docs/额外api-get_avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```markdown
# API: get_avatar

获取用户头像。

## 返回值

```go
type GetAvatarResponse struct {
Message string `json:"message"`
RetCode int `json:"retcode"`
Echo interface{} `json:"echo"`
UserID int64 `json:"user_id"`
}
```

## 所需字段

- **group_id**: 群号(当获取群成员头像时需要)
- **user_id**: 用户 QQ 号(当获取私信头像时需要)

## CQcode

CQ头像码格式.支持message segment式传参,将at segment类比修改为avatar即可.
[CQ:avatar,qq=123456]

```
Loading
Loading