# Discord 机器人设置

在运行机器人之前，你需要一个 Discord 应用和机器人令牌。

***

## 1. 创建应用

1. 前往 [Discord 开发者门户](https://discord.com/developers/applications).
2. 点击 **新建应用**.
3. 给它起一个名称（例如“Verbal Warning Logger”），然后点击 **创建**.

***

## 2. 创建机器人用户

1. 在左侧边栏中，点击 **机器人**.
2. 点击 **添加机器人** → **是的，继续！**
3. 在机器人的用户名下方，点击 **重置令牌**，然后复制该令牌。

> 请妥善保管此令牌。任何拥有它的人都可以控制你的机器人。将它存储在你的 `.env` 文件中，并且永远不要将其提交到版本控制。

***

## 3. 配置 intents

在同一 **机器人** 页面上，向下滚动到 **特权网关 Intents** 并启用：

* **服务器成员 Intent** — 用于角色层级权限检查

该 **消息内容 Intent** 不是核心功能所必需的。

***

## 4. 邀请机器人加入你的服务器

1. 在左侧边栏中，点击 **OAuth2 → URL 生成器**.
2. 在 **范围**下，选择：
   * `bot`
   * `applications.commands`
3. 在 **机器人权限**下，选择：
   * `发送消息`
   * `嵌入链接`
   * `读取消息历史`
   * `查看频道`
4. 复制生成的 URL，在浏览器中打开它，并选择要将机器人添加到的服务器。

***

## 5. 收集你的服务器 ID

你将需要从你的 Discord 服务器获取一些 ID，用于 `.env` 配置：

| 值           | 获取方式                           |
| ----------- | ------------------------------ |
| **日志频道 ID** | 右键单击该频道 → 复制频道 ID（需要开启开发者模式）   |
| **员工角色 ID** | 服务器设置 → 角色 → 右键单击该角色 → 复制角色 ID |

要启用开发者模式：用户设置 → 高级 → 开发者模式。


---

# 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.vigila.augystudios.com/zh/zi-tuo-guan/discord-setup.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.
