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

# 申请 Telegram Bot 指南

> 本文整理 Telegram Bot 的基础申请流程，帮助首次接入 Telegram 官方机器人平台的开发者快速了解整体流程。

<Info>
  本文内容根据 2026 年 3 月 1 日可访问的 Telegram 官方文档整理。平台页面和指令可能调整，实际操作时应以 Telegram 客户端和官方文档为准。
</Info>

## 官方入口

* BotFather 网页版入口：[https://t.me/BotFather](https://t.me/BotFather)
* BotFather 客户端入口：[@BotFather](https://t.me/BotFather)

## 申请流程

### 1. 打开 BotFather

在 Telegram 中搜索 `@BotFather`，确认账号为官方账号后，点击 `Start` 开始会话。

<Warning>
  请确认用户名为 `@BotFather`。不要使用名称相似的第三方机器人。
</Warning>

### 2. 创建机器人

向 BotFather 发送 `/newbot` 指令，开始创建新的 Telegram Bot。

### 3. 设置机器人名称

根据提示输入机器人名称。该名称会显示在机器人资料页和会话界面中。

### 4. 设置机器人用户名

继续根据提示设置机器人用户名。用户名必须满足以下要求：

* 长度为 5 到 32 个字符
* 只能使用英文大小写字母、数字和下划线
* 必须以 `bot` 结尾，例如 `example_bot` 或 `ExampleBot`

### 5. 获取 Bot Token

创建成功后，BotFather 会返回该机器人的 Bot Token。后续调用 Telegram Bot API 时，需要使用该 Token 完成身份校验。

<Warning>
  Bot Token 属于敏感凭证，请像密码一样妥善保管，不要泄露给无关人员，也不要提交到代码仓库。
</Warning>

### 6. 示例

图中标记 1 为你的机器人用户名，标记 2 为 Bot Token。

<Frame>
  <img src="https://mintcdn.com/onetoken/GDTo3g87YLwDGss5/images/%E7%94%B3%E8%AF%B7telegramBot.webp?fit=max&auto=format&n=GDTo3g87YLwDGss5&q=85&s=0b4b8a67c157f21e192781d4674653dd" alt="申请telegram Bot" width="760" height="1588" data-path="images/申请telegramBot.webp" />
</Frame>

### 7. 获取自己的 UserID

<Check>
  获取自己的 UserID 后，可在后续配置白名单时使用，以便“小龙虾”对白名单用户直接放行对话
</Check>

向 `@userinfobot` 发送 `/start` 指令，即可获取自己的 UserID。下方图片中已打码的部分为你的 UserID。

<Frame>
  <img src="https://mintcdn.com/onetoken/GDTo3g87YLwDGss5/images/%E8%8E%B7%E5%8F%96TGID.webp?fit=max&auto=format&n=GDTo3g87YLwDGss5&q=85&s=ecdba42cceaf2b0561c6214025b8105d" alt="获取TGID" width="760" height="1294" data-path="images/获取TGID.webp" />
</Frame>
