curl -X POST "http://localhost:5001/channel/info" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}'
const response = await fetch('http://localhost:5001/channel/info', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 1,
ban: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}
response = requests.post('http://localhost:5001/channel/info', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/info",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
频道管理
更新频道信息
更新或添加频道基本信息
POST
/
channel
/
info
curl -X POST "http://localhost:5001/channel/info" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}'
const response = await fetch('http://localhost:5001/channel/info', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 1,
ban: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}
response = requests.post('http://localhost:5001/channel/info', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/info",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
概述
更新或添加频道的基本信息,包括频道类型、大群标识、禁言状态等。请求体
必传参数
string
必填
频道 ID
integer
必填
频道类型
1- 个人频道2- 群组频道
可选参数
integer
默认值:0
是否禁言
0- 允许发言1- 全员禁言
integer
默认值:0
是否解散频道
1- 解散频道(不可逆)
integer
默认值:0
是否禁止发送消息 (0.不禁止 1.禁止),禁止后,频道内所有成员都不能发送消息,个人频道能收消息,但不能发消息
integer
默认值:0
是否允许陌生人发送消息(0.不允许 1.允许)(此配置目前只支持个人频道)
个人频道:如果AllowStranger为1,则陌生人可以给当前用户发消息,比如:当前账号需要接受陌生人消息,channel_id为当前用户的uid
curl -X POST "http://localhost:5001/channel/info" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}'
const response = await fetch('http://localhost:5001/channel/info', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 1,
ban: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0
}
response = requests.post('http://localhost:5001/channel/info', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 1,
"ban": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/info",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
响应字段
string
必填
操作状态,成功时返回
"ok"状态码
| 状态码 | 说明 |
|---|---|
| 200 | 频道信息更新成功 |
| 400 | 请求参数错误 |
| 404 | 频道不存在 |
| 500 | 服务器内部错误 |
参数详解
频道类型 (channel_type)
| 值 | 类型 | 说明 | 特点 |
|---|---|---|---|
| 1 | 个人频道 | 一对一私聊 | 只有两个成员,不支持群组功能 |
| 2 | 群组频道 | 多人群聊 | 支持多成员、群管理等功能 |
禁言状态 (ban)
| 值 | 说明 | 影响范围 | 管理权限 |
|---|---|---|---|
| 0 | 允许发言 | 所有成员可正常发送消息 | 群主和管理员可修改 |
| 1 | 全员禁言 | 只有管理员可发送消息 | 仅群主可修改 |
⌘I

