> ## 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="ban" type="integer" default={0}>
  是否禁言

  * `0` - 允许发言
  * `1` - 全员禁言
</ParamField>

<ParamField body="disband" type="integer" default={0}>
  是否解散频道

  * `1` - 解散频道（不可逆）
</ParamField>

<ParamField body="send_ban" type="integer" default={0}>
  是否禁止发送消息 （0.不禁止 1.禁止），禁止后，频道内所有成员都不能发送消息,个人频道能收消息，但不能发消息
</ParamField>

<ParamField body="allow_stranger" type="integer" default={0}>
  是否允许陌生人发送消息（0.不允许 1.允许）（此配置目前只支持个人频道）
  个人频道：如果AllowStranger为1，则陌生人可以给当前用户发消息，比如：当前账号需要接受陌生人消息，channel\_id为当前用户的uid
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:5001/channel/info" \
    -H "Content-Type: application/json" \
    -d '{
      "channel_id": "group123",
      "channel_type": 2,
      "large": 1,
      "ban": 0
    }'
  ```

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

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

  ```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,
          "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)
  }
  ```
</RequestExample>

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

## 响应字段

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

## 状态码

| 状态码 | 说明       |
| --- | -------- |
| 200 | 频道信息更新成功 |
| 400 | 请求参数错误   |
| 404 | 频道不存在    |
| 500 | 服务器内部错误  |

## 参数详解

### 频道类型 (channel\_type)

| 值 | 类型   | 说明    | 特点             |
| - | ---- | ----- | -------------- |
| 1 | 个人频道 | 一对一私聊 | 只有两个成员，不支持群组功能 |
| 2 | 群组频道 | 多人群聊  | 支持多成员、群管理等功能   |

### 禁言状态 (ban)

| 值 | 说明   | 影响范围        | 管理权限      |
| - | ---- | ----------- | --------- |
| 0 | 允许发言 | 所有成员可正常发送消息 | 群主和管理员可修改 |
| 1 | 全员禁言 | 只有管理员可发送消息  | 仅群主可修改    |
