curl -X POST "http://localhost:5001/channel/blacklist_add" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}'
const response = await fetch('http://localhost:5001/channel/blacklist_add', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
uids: ['user456', 'user789']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}
response = requests.post('http://localhost:5001/channel/blacklist_add', 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,
"uids": []string{"user456", "user789"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/blacklist_add",
"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
/
blacklist_add
curl -X POST "http://localhost:5001/channel/blacklist_add" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}'
const response = await fetch('http://localhost:5001/channel/blacklist_add', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
uids: ['user456', 'user789']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}
response = requests.post('http://localhost:5001/channel/blacklist_add', 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,
"uids": []string{"user456", "user789"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/blacklist_add",
"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- 群组频道
curl -X POST "http://localhost:5001/channel/blacklist_add" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}'
const response = await fetch('http://localhost:5001/channel/blacklist_add', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
uids: ['user456', 'user789']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"uids": ["user456", "user789"]
}
response = requests.post('http://localhost:5001/channel/blacklist_add', 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,
"uids": []string{"user456", "user789"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/blacklist_add",
"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 | 请求参数错误 |
| 403 | 没有管理权限 |
| 404 | 频道不存在 |
| 500 | 服务器内部错误 |
黑名单机制
限制范围
被加入黑名单的用户将受到以下限制:| 操作 | 限制效果 | 说明 |
|---|---|---|
| 发送消息 | 禁止发送 | 无法在频道内发送任何消息 |
权限层级
黑名单的优先级高于其他权限设置:- 黑名单 > 白名单 > 普通成员权限
- 管理员权限 > 黑名单(管理员不受黑名单限制)
- 系统用户 > 黑名单(系统用户不受黑名单限制)
使用场景
违规处理
- 发送违规内容:对发送不当内容的用户进行限制
- 恶意行为:处理恶意刷屏、骚扰等行为
- 违反规则:对违反群组规则的用户进行惩罚
⌘I

