群内消息类型控制
群内消息类型控制
Section titled “群内消息类型控制”https://chat-go.jwzhd.com/open-apis/v1/group/msg-type-limit?token=xxxxxxxxxx
POST
curl --location --request POST 'https://chat-go.jwzhd.com/open-apis/v1/group/msg-type-limit?token=xxxxxxxxxx' \--header 'Content-Type: application/json' \--data-raw '{ "groupId": "123456", "type": "text,image,video"}'Content-Type: "application/json; charset=utf-8"| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| groupId | string | 是 | 群组ID |
| type | string | 否 | 允许的消息类型,多个类型用逗号分隔。为空表示不限制任何消息类型 |
type参数说明
Section titled “type参数说明”type参数为消息类型名称,多个类型用逗号分隔,如:"text,image,video"
为空时表示不限制任何消息类型
消息类型对照表
Section titled “消息类型对照表”| 类型名称 | 说明 |
|---|---|
| text | 文本消息 |
| image | 图片消息 |
| markdown | MARKDOWN消息 |
| file | 文件消息 |
| post | 帖子消息 |
| expression | 表情消息 |
| html | HTML消息 |
| video | 视频消息 |
| audio | 语音消息 |
| liveAudio | 语音通话 |
机器人需要在该群聊中,且拥有允许修改群信息权限(allowEditGroupInfo = 1)
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 响应代码 |
| msg | string | 响应信息,包括异常信息 |
| data | Object | 返回数据 |
{ "code": 1, "msg": "success", "data": {}}| 错误码 | 说明 |
|---|---|
| 1002 | 参数缺失或有误 |
| 1003 | 未授权(非法token) |
| -1 | 业务错误(如机器人不在群中、无权限等) |
允许多种消息类型
Section titled “允许多种消息类型”{ "groupId": "123456", "type": "text,image,video,audio"}只允许文本消息
Section titled “只允许文本消息”{ "groupId": "123456", "type": "text"}不限制消息类型
Section titled “不限制消息类型”{ "groupId": "123456", "type": ""}