# 示例代码

你可以点击wechaty 官方示例文档地址查看所有的示例代码

{% embed url="<https://github.com/Chatie/wechaty-getting-started/tree/master/examples>" %}

## 1. 基本版本 <a href="#basic" id="basic"></a>

代码内容详见： <https://github.com/wechaty/wechaty-getting-started/tree/master/examples/basic>

| 文件名称                                                                                                                                                                          | 描述                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| [the-worlds-shortest-chatbot-code-in-6-lines.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/basic/the-worlds-shortest-chatbot-code-in-6-lines.js) | 最基础的wechaty 运行例子             |
| [ding-dong-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/basic/ding-dong-bot.js)                                                             | 处理收发消息的例子                    |
| [contact-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/basic/contact-bot.js)                                                                 | 在终端下输出微信号下联系人的 *微信ID* 和 *昵称* |

### 2. 进阶版本 <a href="#advanced" id="advanced"></a>

代码内容详见：<https://github.com/wechaty/wechaty-getting-started/tree/master/examples/advanced>

| 文件名称                                                                                                                                                                                                                          | 描述                            |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| [demo-in-tutorial.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/demo-in-tutorial.js)                                                                                                    | 视频教程中的代码例子                    |
| [busy-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/busy-bot.js)                                                                                                                    | 设置微信的状态，当是busy 状态的时候自动回复`我很忙` |
| [media-file-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/media-file-bot.js)                                                                                                        | 将消息中的文件、图片、视频等非文本信息存到本地。      |
| [room-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/room-bot.js),[room-say-cli.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/room-say-cli.js) | 处理微信群消息的代码例子                  |
| [friend-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/advanced/friend-bot.js)                                                                                                                | 处理好友请求的代码例子                   |
| [gist-bot/](https://github.com/Chatie/wechaty-getting-started/tree/master/examples/advanced/gist-bot)                                                                                                                         | 将不同的处理模块分散到不同文件里面的代码例子        |

### 3. 专业版本 <a href="#professional" id="professional"></a>

代码内容详见：<https://github.com/wechaty/wechaty-getting-started/tree/master/examples/professional>

| 文件名称                                                                                                                               | 描述                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [hot-import-bot/](https://github.com/Chatie/wechaty-getting-started/tree/master/examples/professional/hot-import-bot)              | 为Wechaty 增加热加载                                        |
| [ctrl-c-signal-bot.ts](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/professional/ctrl-c-signal-bot.ts)   | 对 Ctrl-C 操作的处理例子                                      |
| [monster-bot/](https://github.com/Chatie/wechaty-getting-started/tree/master/examples/professional/monster-bot)                    | 一个包含了消息、群、热加载和信号处理的例子，每个处理模块在单独的文件中                   |
| [api-ai-bot.ts](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/professional/api-ai-bot.ts)                 | wechaty 和 [dialogflow](https://dialogflow.com/) 结合的代码 |
| [speech-to-text-bot.ts](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/professional/speech-to-text-bot.ts) | 接入百度语音转文字，自动将微信语音转换成文字                                |
| [tuling123-bot.ts](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/professional/tuling123-bot.js)           | 接入 [tuling123](http://www.tuling123.com/)机器人          |
| [telegram-roger-bot.js](https://github.com/Chatie/wechaty-getting-started/blob/master/examples/professional/telegram-roger-bot.js) | 同时在telegram 和 wechaty 中运行的机器人                         |
| [blessed-twins-bot/](https://github.com/Chatie/wechaty-getting-started/tree/master/examples/professional/blessed-twins-bot)        | 多实例运行例子 （支持wechaty v0.16 以上的版本）                       |


---

# 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://wechaty.gitbook.io/wechaty/zh/example.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.
