# 示例代码

你可以点击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](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](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](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 以上的版本）                       |
