1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

feat: del group notice (#1567)

* update dep

* feat: _del_group_notice

* doc: get_group_notice && del_group_notice
This commit is contained in:
秋葉杏 2022-07-09 12:57:53 +08:00 committed by GitHub
parent 551a475c1c
commit 36bf579e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 9 deletions

View File

@ -1114,6 +1114,23 @@ func (bot *CQBot) CQSetGroupMemo(groupID int64, msg, img string) global.MSG {
return Failed(100, "GROUP_NOT_FOUND", "群聊不存在") 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 群组踢人 // CQSetGroupKick 群组踢人
// //
// https://git.io/Jtz1V // https://git.io/Jtz1V

View File

@ -42,6 +42,8 @@
- [设置群名](#设置群名) - [设置群名](#设置群名)
- [获取用户VIP信息](#获取用户vip信息) - [获取用户VIP信息](#获取用户vip信息)
- [发送群公告](#发送群公告) - [发送群公告](#发送群公告)
- [获取群公告](#获取群公告)
- [删除群公告](#删除群公告)
- [设置精华消息](#设置精华消息) - [设置精华消息](#设置精华消息)
- [移出精华消息](#移出精华消息) - [移出精华消息](#移出精华消息)
- [获取精华消息列表](#获取精华消息列表) - [获取精华消息列表](#获取精华消息列表)
@ -244,7 +246,8 @@ Type: `node`
| `seq` | message | 具体消息 | 用于自定义消息 | | `seq` | message | 具体消息 | 用于自定义消息 |
特殊说明: **需要使用单独的API `/send_group_forward_msg` 发送并且由于消息段较为复杂仅支持Array形式入参。 如果引用消息和自定义消息同时出现,实际查看顺序将取消息段顺序. 特殊说明: **需要使用单独的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套娃**
示例: 示例:
@ -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`
**参数** **参数**
@ -1108,13 +1111,67 @@ JSON数组:
`该 API 没有响应数据` `该 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` 终结点: `/get_unidirectional_friend_list`
**响应数据** **响应数据**
数组信息: 数组信息:
| 字段 | 类型 | 说明 | | 字段 | 类型 | 说明 |
| ------------- | ------ | -------- | | ------------- | ------ | -------- |

4
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require ( require (
github.com/Microsoft/go-winio v0.5.1 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/syncx v0.0.0-20220404072119-d7ea0ae15a4c
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc
github.com/fumiama/go-base16384 v1.5.2 github.com/fumiama/go-base16384 v1.5.2
@ -26,7 +26,7 @@ require (
) )
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/davecgh/go-spew v1.1.1 // indirect
github.com/fumiama/imgsz v0.0.2 // indirect github.com/fumiama/imgsz v0.0.2 // indirect
github.com/go-stack/stack v1.8.0 // indirect github.com/go-stack/stack v1.8.0 // indirect

8
go.sum
View File

@ -1,9 +1,9 @@
github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= 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/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-20220630160133-a39b3fdd962f h1:PHOwN3/cEL/zoBpcJJXwx1mJ1NL901zrt2mvlQUO5BA=
github.com/Mrs4s/MiraiGo v0.0.0-20220622015746-24ee0103e7de/go.mod h1:mZp8Lt7uqLCUwSLouB2yuiP467Cwl4mnG9IMAaXUKA0= github.com/Mrs4s/MiraiGo v0.0.0-20220630160133-a39b3fdd962f/go.mod h1:Ow7nlaVS5FztyjrTlTRSG7HLpTNmgINMluHRCgKunDI=
github.com/RomiChan/protobuf v0.1.1-0.20220602121309-9e3b8cbefd7a h1:WIfEWYj82oEuPtm5pqlyQmCJCoiw00C6ugZFqHA0cC8= github.com/RomiChan/protobuf v0.1.1-0.20220624030127-3310cba9dbc0 h1:+UGPBYVjssFsdahLJIiNPwpmmwgl/OaVdv1oc5NonC0=
github.com/RomiChan/protobuf v0.1.1-0.20220602121309-9e3b8cbefd7a/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA= 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 h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE= 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= github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0=

View File

@ -21,6 +21,10 @@ func (c *Caller) call(action string, p Getter) global.MSG {
case ".ocr_image", "ocr_image": case ".ocr_image", "ocr_image":
p0 := p.Get("image").String() p0 := p.Get("image").String()
return c.bot.CQOcrImage(p0) return c.bot.CQOcrImage(p0)
case "_del_group_notice":
p0 := p.Get("group_id").Int()
p1 := p.Get("notice_id").String()
return c.bot.CQDelGroupMemo(p0, p1)
case "_get_group_notice": case "_get_group_notice":
p0 := p.Get("group_id").Int() p0 := p.Get("group_id").Int()
return c.bot.CQGetGroupMemo(p0) return c.bot.CQGetGroupMemo(p0)