> ## Documentation Index
> Fetch the complete documentation index at: https://wukong.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 添加频道黑名单

> 将用户添加到频道黑名单

## 概述

将用户添加到频道黑名单，被加入黑名单的用户将无法加入频道或发送消息。

## 请求体

<ParamField body="channel_id" type="string" required>
  频道 ID
</ParamField>

<ParamField body="channel_type" type="integer" required>
  频道类型

  * `1` - 个人频道
  * `2` - 群组频道
</ParamField>

<ParamField body="uids" type="array" required>
  要添加到黑名单的用户 ID 列表

  <ParamField body="uids[]" type="string">
    用户 ID
  </ParamField>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:5001/channel/blacklist_add" \
    -H "Content-Type: application/json" \
    -d '{
      "channel_id": "group123",
      "channel_type": 2,
      "uids": ["user456", "user789"]
    }'
  ```

  ```javascript JavaScript theme={null}
  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);
  ```

  ```python Python theme={null}
  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)
  ```

  ```go Go theme={null}
  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)
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 成功响应 theme={null}
  {
    "status": "ok"
  }
  ```
</ResponseExample>

## 响应字段

<ResponseField name="status" type="string" required>
  操作状态，成功时返回 `"ok"`
</ResponseField>

## 状态码

| 状态码 | 说明      |
| --- | ------- |
| 200 | 黑名单操作成功 |
| 400 | 请求参数错误  |
| 403 | 没有管理权限  |
| 404 | 频道不存在   |
| 500 | 服务器内部错误 |

## 黑名单机制

### 限制范围

被加入黑名单的用户将受到以下限制：

| 操作   | 限制效果 | 说明           |
| ---- | ---- | ------------ |
| 发送消息 | 禁止发送 | 无法在频道内发送任何消息 |

### 权限层级

黑名单的优先级高于其他权限设置：

1. **黑名单** > 白名单 > 普通成员权限
2. **管理员权限** > 黑名单（管理员不受黑名单限制）
3. **系统用户** > 黑名单（系统用户不受黑名单限制）

## 使用场景

### 违规处理

* **发送违规内容**：对发送不当内容的用户进行限制
* **恶意行为**：处理恶意刷屏、骚扰等行为
* **违反规则**：对违反群组规则的用户进行惩罚
