# 登录

## 登录

初始化完成后，您可以通过输入用户名、姓名和可选的个人资料图片地址进行连接。

### 连接

```csharp
await nc.Connect(
    id: [USERNAME],
    name: [NAME],
    profile: [PROFILE_URL],
    customField: [CUSTOM_FIELD],
    token: [TOKEN]
);
```

<table><thead><tr><th width="233">ID</th><th width="126">Type</th><th width="249">Description</th><th>Required</th></tr></thead><tbody><tr><td>USERNAME</td><td>string</td><td>用户ID</td><td>O</td></tr><tr><td>NAME</td><td>string</td><td>昵称</td><td>X</td></tr><tr><td>PROFILE_URL</td><td>string</td><td>个人资料图片地址 URL</td><td>X</td></tr><tr><td>LANGUAGE</td><td>string</td><td>语言代码</td><td>X</td></tr><tr><td>CUSTOM_FIELD</td><td>string</td><td>自定义字段</td><td>X</td></tr><tr><td>TOKEN</td><td>string</td><td>令牌值</td><td>X</td></tr></tbody></table>

> 参考
>
> * 为了安全登录，建议通过 API 获取令牌。
> * 您可以通过 [TOKEN API 文档](https://api.ncloud-docs.com/docs/en/bizapp-token-issuance)中描述的 API 来使用已颁发的令牌。
> * 如果不使用令牌方式，请在控制面板 > 安全设置 > 令牌认证 中设置为不使用。

### 断开连接

要断开与已连接的 Game Chat 服务器的连接，请使用以下代码。

```csharp
await nc.Disconnect();
```

### 用户信息

* Member Data Class

<table><thead><tr><th width="181">ID</th><th width="216">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>string</td><td>사용자 ID</td></tr><tr><td>name</td><td>string</td><td>사용자 이름</td></tr><tr><td>profile</td><td>string</td><td>이미지 주소</td></tr></tbody></table>

#### 获取用户信息

获取特定用户ID的信息（出于安全考虑，只传递昵称）。

```csharp
Hashtable filter = new Hashtable
{
    { "id", [USER_ID] }
};
Hashtable sort = new Hashtable
{
    { "created_at", -1 }
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 }
};
var users = await nc.getUsers(filter, sort, option);
```

* Parameters

<table><thead><tr><th width="111">ID</th><th width="93">Type</th><th width="440">Description</th><th>Required</th></tr></thead><tbody><tr><td>filter</td><td>object</td><td>可以对所有字段进行搜索。</td><td>O</td></tr><tr><td>sort</td><td>object</td><td>定义要排序字段的过滤器（升序为 "1"，降序为 "-1"）。</td><td>X</td></tr><tr><td>option</td><td>object</td><td>如有可选项，请参阅下方参考内容。</td><td>X</td></tr></tbody></table>

* Options

<table><thead><tr><th width="207">ID</th><th width="208">Type</th><th>Description</th></tr></thead><tbody><tr><td>offset</td><td>number</td><td>起始offset</td></tr><tr><td>per_page</td><td>number</td><td>返回的数量（最多 100 个）</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamechat.me/basics/game-chat-v3/game-chat-zhong-wen/kai-shi-shi-yong-v3/deng-lu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
