Skip to content

Commit

Permalink
feat: del group notice (#1567)
Browse files Browse the repository at this point in the history
* update dep

* feat: _del_group_notice

* doc: get_group_notice && del_group_notice
  • Loading branch information
Akegarasu committed Jul 9, 2022
1 parent 551a475 commit 36bf579
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 9 deletions.
17 changes: 17 additions & 0 deletions coolq/api.go
Expand Up @@ -1114,6 +1114,23 @@ func (bot *CQBot) CQSetGroupMemo(groupID int64, msg, img string) global.MSG {
return Failed(100, "GROUP_NOT_FOUND", "群聊不存在")
}

// CQDelGroupMemo 扩展API-删除群公告
// @route(_del_group_notice)
// @rename(fid->notice_id)
func (bot *CQBot) CQDelGroupMemo(groupID int64, fid string) global.MSG {
if g := bot.Client.FindGroup(groupID); g != nil {
if g.SelfPermission() == client.Member {
return Failed(100, "PERMISSION_DENIED", "权限不足")
}
err := bot.Client.DelGroupNotice(groupID, fid)
if err != nil {
return Failed(100, "DELETE_NOTICE_ERROR", err.Error())
}
return OK(nil)
}
return Failed(100, "GROUP_NOT_FOUND", "群聊不存在")
}

// CQSetGroupKick 群组踢人
//
// https://git.io/Jtz1V
Expand Down
63 changes: 60 additions & 3 deletions docs/cqhttp.md
Expand Up @@ -42,6 +42,8 @@
- [设置群名](#设置群名)
- [获取用户VIP信息](#获取用户vip信息)
- [发送群公告](#发送群公告)
- [获取群公告](#获取群公告)
- [删除群公告](#删除群公告)
- [设置精华消息](#设置精华消息)
- [移出精华消息](#移出精华消息)
- [获取精华消息列表](#获取精华消息列表)
Expand Down Expand Up @@ -244,7 +246,8 @@ Type: `node`
| `seq` | message | 具体消息 | 用于自定义消息 |

特殊说明: **需要使用单独的API `/send_group_forward_msg` 发送,并且由于消息段较为复杂,仅支持Array形式入参。 如果引用消息和自定义消息同时出现,实际查看顺序将取消息段顺序.
另外按 [Onebot v11](https://github.com/botuniverse/onebot-11/blob/master/message/array.md) 文档说明, `data` 应全为字符串, 但由于需要接收`message` 类型的消息, 所以 *仅限此Type的content字段* 支持Array套娃**
另外按 [Onebot v11](https://github.com/botuniverse/onebot-11/blob/master/message/array.md) 文档说明, `data` 应全为字符串,
但由于需要接收`message` 类型的消息, 所以 *仅限此Type的content字段* 支持Array套娃**

示例:

Expand Down Expand Up @@ -627,7 +630,7 @@ Type: `rps`

### 发送合并转发(群/私聊)

终结点: `/send_group_forward_msg`, `send_private_forward_msg`, `send_forward_msg`
终结点: `/send_group_forward_msg`, `send_private_forward_msg`, `send_forward_msg`

**参数**

Expand Down Expand Up @@ -1108,13 +1111,67 @@ JSON数组:

`该 API 没有响应数据`

### 获取群公告

终结点: `/_get_group_notice`

**参数**

| 字段名 | 数据类型 | 默认值 | 说明 |
| ---------- | -------- | ------ | -------- |
| `group_id` | int64 | | 群号 |

**响应数据**

数组信息:

| 字段名 | 数据类型 | 默认值 | 说明 |
|----------------|--------| ------ |-------|
| `notice_id` | string | | 公告id |
| `sender_id` | string | | 发布者id |
| `publish_time` | string | | 发布时间 |
| `message` | GroupNoticeMessage | | 公告id |

响应示例

```json
{
"data": [
{
"notice_id": "8850de2e00000000cc6bbd628a150c00",
"sender_id": 1111111,
"publish_time": 1656581068,
"message": {
"text": "这是一条公告",
"images": []
}
}
],
"retcode": 0,
"status": "ok"
}
```

### 删除群公告

终结点: `/_del_group_notice`

**参数**

| 字段名 | 数据类型 | 默认值 | 说明 |
|-------------| -------- | ------ |------|
| `group_id` | int64 | | 群号 |
| `notice_id` | string | | 公告id |

`该 API 没有响应数据`

### 获取单向好友列表

终结点: `/get_unidirectional_friend_list`

**响应数据**

数组信息:
数组信息:

| 字段 | 类型 | 说明 |
| ------------- | ------ | -------- |
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/Microsoft/go-winio v0.5.1
github.com/Mrs4s/MiraiGo v0.0.0-20220622015746-24ee0103e7de
github.com/Mrs4s/MiraiGo v0.0.0-20220630160133-a39b3fdd962f
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc
github.com/fumiama/go-base16384 v1.5.2
Expand All @@ -26,7 +26,7 @@ require (
)

require (
github.com/RomiChan/protobuf v0.1.1-0.20220602121309-9e3b8cbefd7a // indirect
github.com/RomiChan/protobuf v0.1.1-0.20220624030127-3310cba9dbc0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fumiama/imgsz v0.0.2 // indirect
github.com/go-stack/stack v1.8.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
@@ -1,9 +1,9 @@
github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY=
github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
github.com/Mrs4s/MiraiGo v0.0.0-20220622015746-24ee0103e7de h1:senbiV71dgsYt60BWLEHWwvKFCYUcIzGQ/fmXRaOeQ4=
github.com/Mrs4s/MiraiGo v0.0.0-20220622015746-24ee0103e7de/go.mod h1:mZp8Lt7uqLCUwSLouB2yuiP467Cwl4mnG9IMAaXUKA0=
github.com/RomiChan/protobuf v0.1.1-0.20220602121309-9e3b8cbefd7a h1:WIfEWYj82oEuPtm5pqlyQmCJCoiw00C6ugZFqHA0cC8=
github.com/RomiChan/protobuf v0.1.1-0.20220602121309-9e3b8cbefd7a/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA=
github.com/Mrs4s/MiraiGo v0.0.0-20220630160133-a39b3fdd962f h1:PHOwN3/cEL/zoBpcJJXwx1mJ1NL901zrt2mvlQUO5BA=
github.com/Mrs4s/MiraiGo v0.0.0-20220630160133-a39b3fdd962f/go.mod h1:Ow7nlaVS5FztyjrTlTRSG7HLpTNmgINMluHRCgKunDI=
github.com/RomiChan/protobuf v0.1.1-0.20220624030127-3310cba9dbc0 h1:+UGPBYVjssFsdahLJIiNPwpmmwgl/OaVdv1oc5NonC0=
github.com/RomiChan/protobuf v0.1.1-0.20220624030127-3310cba9dbc0/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0=
Expand Down
4 changes: 4 additions & 0 deletions modules/api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 36bf579

Please sign in to comment.