# Telegram

## Telegram 推送类型

1. [User（消息发送给个人用户）](#ru-he-she-zhi-user)
2. [Group（消息发送给群组）](#ru-he-she-zhi-group)
3. [Channel](#ru-he-she-zhi-channel-qu-dao)[（消息发送给频道）](#ru-he-she-zhi-channel)
4. [Bot（创建自己品牌的 TG Bot）](#ru-he-she-zhi-bot)

对于 1 User、2 Group、3 Channel 类型的推送消息都由 ChainBot 的官方 [Telegram Bot](https://t.me/chainbot_bot) 推送。

对于4 Bot，您可以配置属于自己品牌的 TG Bot，以便将自己的 Bot 传播出去给更多的个人、群组和频道使用。

### 如何设置 User？ <a href="#set-user" id="set-user"></a>

1. 选择Chat Type为User。
2. 点击Get Chat ID跳转到 Telegram 的软件。
3. 选择 "Start" 后，将会收到一条 ChainBot 发送的一条消息，消息内容中包含 Chat ID。
4. 复制 Chat ID 填写到 ChainBot 平台即可。

<figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2FK64lut4GfX06gnA3hhkC%2Ftelegram.png?alt=media&#x26;token=631e7613-3ddd-4d96-887e-bd245a20f85f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/sbccXqjLi8Naz4ALu2W9/image.png" alt=""><figcaption><p>Got your Chat ID</p></figcaption></figure>

<figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2FjXj276vgvCpNtpqkFGNd%2Ftelegram-1.png?alt=media&#x26;token=98570eab-3b20-41ec-a7b4-3a1608b2ed95" alt=""><figcaption></figcaption></figure>

### 如何设置 Group？ <a href="#set-group" id="set-group"></a>

1. 选择Chat Type为Group。
2. 将Chainbot机器人拉入到Group。
3. Group分为\*\*Private(私有)和Public(公开)\*\*两类, 首先确认Group的类型。
4. 如果是Private(私有) Group, 需要填写**带负号的Chat ID,** 如 -123456。
5. 如果是Public(公开) Group, 需要填写带\*\*@符号的Group Name,\*\* 如 @chainbot\_group。
6. 复制带负号的Chat ID 或带@符号的Group Name, 填写到 ChainBot 平台即可。

#### 将Chainbot机器人拉入到Group

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/TAkmnWzybFuNPgVh8i1N/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/IBMSDYK7xcRn3PTElqbt/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/auWDWDyKmKpGyBpf4Wxk/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/SVHNfLrDXBccEPAYP6rz/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/AUSfvEJsPm5b64jyclHK/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/2WF2yMuiQ2B3TCBfBzzz/image.png" alt=""><figcaption></figcaption></figure>

#### 确认Group的类型 <a href="#confirm-group-type" id="confirm-group-type"></a>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/YGB3TMyosTItlatpYCiX/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/nqVJ0VOhOHI7DDHcamC7/image.png" alt=""><figcaption></figcaption></figure>

#### 获取Chat ID或Group Name

**需要在Web端打开Telegram,** [**https://web.telegram.org/**](https://web.telegram.org/)

从网页URL上获取Public Group的Group Name, 如 @chainbot\_public\_group

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/H4BaRmo9N7nwBibtPnst/image.png" alt=""><figcaption></figcaption></figure>

从网页URL上获取Private Group的Chat ID, 如 -811463215

<figure><img src="https://content.gitbook.com/content/moG8PqN7GJCejgjqG74o/blobs/hXbGrOauguzLh6bSQW6m/image.png" alt=""><figcaption></figcaption></figure>

#### 在Chainbot平台, 填写Chat ID或Group Name

<figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2F2kX0uWbOC4vvCX6a8cSu%2Ftelegram-2.png?alt=media&#x26;token=58948270-5b2f-4e9d-89da-ee632b829035" alt=""><figcaption></figcaption></figure>

### 如何设置 Channel？ <a href="#set-channel" id="set-channel"></a>

1. 选择Chat Type为Channel (操作步骤与Group一致)。
2. 将Chainbot机器人拉入到Channel, **并设置为管理员** (操作步骤与Group一致)。
3. Channel分为Private(私有)和Public(公开)两类, **只能推送到Public类型的Channel,** 首先确认Channel的类型 (操作步骤与Group一致)
4. 如果是Public(公开) Channel, 需要填写带\*\*@符号的Channel Name,\*\* 如 @chainbot\_channel。(操作步骤与Group一致)

### 如何设置 Bot <a href="#set-bot" id="set-bot"></a>

1. 首先您需要创建一个自己的 Telegram Bot ，参考Telegram的[官方教程](https://core.telegram.org/bots/features#creating-a-new-bot)。

2. 使用 [BotFather](https://t.me/BotFather) 创建好属于自己的Bot后，您将看到这个 Bot 的 API Token。或者您可以在 /mybots 命令的菜单中再次选择刚刚创建的Bot查看此 API Token。

   <figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2FpsXma6GobOEviII9pPAk%2Fimage.png?alt=media&#x26;token=2b616516-1ace-4e65-b239-7a52afd4a6e5" alt=""><figcaption></figcaption></figure>

3. 点击复制这一段 API Token，回到ChainBot，Chat Type 选择"Bot"，并将API Token粘贴在对应的输入框内。点击保存<br>

   <figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2FzLqQIMkVFztd8Q4akJXp%2Fimage.png?alt=media&#x26;token=385230a3-1cec-4299-a8e0-c1c408b8abc0" alt=""><figcaption></figcaption></figure>

4. 保存成功后，您可以通过`/start` 和`/stop` 命令来控制您的Bot是否在所在聊天会话中推送消息。例如您可以将这个Bot拉入群组，并作为管理员身份在群组中发送 `/start` 命令，则该TG Bot将会在群里发送您的监控消息。

   <figure><img src="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2F0qiIlU5iwtb8XTMITgrL%2Fimage.png?alt=media&#x26;token=8b2067c5-0707-4e25-a778-f9879abe9654" alt=""><figcaption></figcaption></figure>
