docs: make Chinese README the default
Docker / Build (push) Has been cancelled
Coverage / build (push) Has been cancelled
Node.js CI / build (16, macos-latest) (push) Has been cancelled
Node.js CI / build (16, ubuntu-latest) (push) Has been cancelled
Node.js CI / build (16, windows-latest) (push) Has been cancelled
NPM / Build (22) (push) Has been cancelled
Docker / Publish (push) Has been cancelled
NPM / Pack (push) Has been cancelled
NPM / Publish (push) Has been cancelled
Docker / Build (push) Has been cancelled
Coverage / build (push) Has been cancelled
Node.js CI / build (16, macos-latest) (push) Has been cancelled
Node.js CI / build (16, ubuntu-latest) (push) Has been cancelled
Node.js CI / build (16, windows-latest) (push) Has been cancelled
NPM / Build (22) (push) Has been cancelled
Docker / Publish (push) Has been cancelled
NPM / Pack (push) Has been cancelled
NPM / Publish (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
# Wechaty [](https://discord.gg/7q8NBZbQzt) [](https://www.npmjs.com/package/wechaty) [](https://github.com/wechaty/wechaty/actions?query=workflow%3ANPM) [](https://github.com/wechaty/wechaty/actions?query=workflow%3ADocker)
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/wechaty/wechaty) · [上游 README](https://github.com/wechaty/wechaty/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||
# Wechaty [](https://discord.gg/7q8NBZbQzt) [](https://www.npmjs.com/package/wechaty) [](https://github.com/wechaty/wechaty/actions?query=workflow%3ANPM) [](https://github.com/wechaty/wechaty/actions?query=workflow%3ADocker)
|
||||
|
||||
[](https://wechaty.js.org)
|
||||
|
||||
@@ -30,13 +36,13 @@
|
||||
[](https://t.me/wechaty)
|
||||
-->
|
||||
|
||||
## Elevator Pitch
|
||||
## 电梯演讲
|
||||
|
||||
Wechaty is a conversational RPA SDK that simplifies the process of building chatbots. It's like a Swiss Army knife for chatbot development, providing a universal interface to various messaging platforms such as WhatsApp, WeChat, and more. With Wechaty, you write your bot code once, and it runs on any of the supported platforms. This means you can focus on creating engaging conversational experiences without worrying about the underlying complexities of each platform's API. It's open-source, easy to use, and backed by a vibrant community that's ready to help you bring your chatbot ideas to life.
|
||||
Wechaty 是一款对话式 RPA(Robotic Process Automation,机器人流程自动化)SDK,可简化聊天机器人(chatbot)的构建流程。它就像聊天机器人开发中的瑞士军刀,为 WhatsApp、WeChat 等众多消息平台提供统一接口。使用 Wechaty,你只需编写一次机器人代码,即可在任意受支持平台上运行。这意味着你可以专注于打造引人入胜的对话体验,而无需操心各平台 API 的底层复杂性。它是开源的、易于使用的,并有活跃社区支持,随时帮助你把聊天机器人想法变为现实。
|
||||
|
||||
## Connecting Chatbots
|
||||
## 连接聊天机器人
|
||||
|
||||
Wechaty is an RPA (Robotic Process Automation) SDK for Chatbot Makers which can help you create a bot in 6 lines of [JavaScript](https://GitHub.com/Wechaty/wechaty), [Python](https://GitHub.com/Wechaty/python-wechaty/), [Go](https://GitHub.com/Wechaty/go-wechaty/), and [Java](https://GitHub.com/Wechaty/java-wechaty/), with cross-platform support including [Linux, Windows, MacOS](https://github.com/wechaty/wechaty/actions?query=workflow%3ANPM), and [Docker](https://github.com/wechaty/wechaty/actions?query=workflow%3ADocker).
|
||||
Wechaty 是一款面向 Chatbot 开发者的 RPA(Robotic Process Automation)SDK,可帮助你用 6 行 [JavaScript](https://GitHub.com/Wechaty/wechaty), [Python](https://GitHub.com/Wechaty/python-wechaty/), [Go](https://GitHub.com/Wechaty/go-wechaty/), 和 [Java](https://GitHub.com/Wechaty/java-wechaty/), 编写机器人,并支持跨平台运行,包括 [Linux、Windows、MacOS](https://github.com/wechaty/wechaty/actions?query=workflow%3ANPM), 和 [Docker](https://github.com/wechaty/wechaty/actions?query=workflow%3ADocker).
|
||||
|
||||
:spider_web: <https://wechaty.js.org>
|
||||
:octocat: <https://github.com/Wechaty/wechaty>
|
||||
@@ -44,58 +50,58 @@ Wechaty is an RPA (Robotic Process Automation) SDK for Chatbot Makers which can
|
||||
:book: <https://github.com/Wechaty/wechaty-getting-started>
|
||||
:whale: <https://hub.docker.com/r/wechaty/wechaty>
|
||||
|
||||
## Breaking News
|
||||
## 突发新闻
|
||||
|
||||
- [重磅:绕过登录限制,wechaty免费版web协议重放荣光, @gengchen528, Apr 13, 2021](https://wechaty.js.org/2021/04/13/wechaty-uos-web/)
|
||||
|
||||
## Voice of Developers
|
||||
## 开发者之声
|
||||
|
||||
> "Wechaty is a great solution; I believe there would be much more users who recognize it." [link](https://github.com/Wechaty/wechaty/pull/310#issuecomment-285574472)
|
||||
> — <cite>@Gcaufy, Tencent Engineer, Author of [WePY](https://github.com/Tencent/wepy)</cite>
|
||||
> "Wechaty 是一个很棒的解决方案;我相信会有更多用户认可它。" [link](https://github.com/Wechaty/wechaty/pull/310#issuecomment-285574472)
|
||||
> — <cite>@Gcaufy,腾讯工程师,[WePY](https://github.com/Tencent/wepy) 作者</cite>
|
||||
>
|
||||
> "太好用,好用的想哭"
|
||||
> — <cite>@xinbenlv, Google Engineer, Founder of HaoShiYou.org</cite>
|
||||
> — <cite>@xinbenlv,Google 工程师,HaoShiYou.org 创始人</cite>
|
||||
>
|
||||
> ”好用到哭“——你们对得起这个评价! [link](https://github.com/bigbrother666sh/shezhangbujianle#%E8%87%B4%E6%95%AC)
|
||||
> — <cite>[@bigbrother666sh](https://github.com/bigbrother666sh), creator of《社长不见了》剧本杀 NPC DM</cite>
|
||||
> — <cite>[@bigbrother666sh](https://github.com/bigbrother666sh), 《社长不见了》剧本杀 NPC DM 创作者</cite>
|
||||
>
|
||||
> "最好的微信开发库" [link](http://weibo.com/3296245513/Ec4iNp9Ld?type=comment)
|
||||
> — <cite>@Jarvis, Baidu Engineer</cite>
|
||||
> — <cite>@Jarvis,百度工程师</cite>
|
||||
>
|
||||
> "Wechaty让运营人员更多的时间思考如何进行活动策划、留存用户,商业变现" [link](http://mp.weixin.qq.com/s/dWHAj8XtiKG-1fIS5Og79g)
|
||||
> — <cite>@lijiarui, Founder & CEO of Juzi.BOT.</cite>
|
||||
> "Wechaty 让运营人员有更多时间思考如何进行活动策划、留存用户和商业变现" [link](http://mp.weixin.qq.com/s/dWHAj8XtiKG-1fIS5Og79g)
|
||||
> — <cite>@lijiarui,Juzi.BOT 创始人兼 CEO。</cite>
|
||||
>
|
||||
> "If you know js ... try Wechaty. It's easy to use."
|
||||
> — <cite>@Urinx Uri Lee, Author of [WeixinBot(Python)](https://github.com/Urinx/WeixinBot)</cite>
|
||||
> "如果你会 js……那就试试 Wechaty。它很容易上手。"
|
||||
> — <cite>@Urinx Uri Lee,[WeixinBot(Python)](https://github.com/Urinx/WeixinBot) 作者</cite>
|
||||
>
|
||||
> "Wechaty is a good project; I hope it can continue! Therefore, I became a contributor in open collective."
|
||||
> "Wechaty 是一个好项目;我希望它能继续下去!因此,我成为了 open collective 的贡献者。"
|
||||
> — <cite>[@Simple](https://github.com/mrwhh)</cite>
|
||||
|
||||
See more at [Wiki:Voice Of Developer](https://github.com/Wechaty/wechaty/wiki/Voice%20Of%20Developer)
|
||||
更多内容见 [Wiki:Voice Of Developer](https://github.com/Wechaty/wechaty/wiki/Voice%20Of%20Developer)
|
||||
|
||||
### Join Us on Discord
|
||||
### 在 Discord 加入我们
|
||||
|
||||
[](https://discord.gg/7q8NBZbQzt)
|
||||
[](https://discord.gg/7q8NBZbQzt)
|
||||
[](https://discord.gg/7q8NBZbQzt)
|
||||
|
||||
Wechaty is used in many ChatBot projects by thousands of developers. To talk with other developers, scan the QR Code below and join our **Wechaty Developer Community**.
|
||||
Wechaty 已被数千名开发者用于众多 ChatBot 项目。要与其他开发者交流,请扫描下方二维码,加入我们的 **Wechaty 开发者社区**。
|
||||
|
||||

|
||||

|
||||
|
||||
Scan now because other Wechaty developers want to talk with you, too!
|
||||
立即扫码,因为其他 Wechaty 开发者也想和你交流!
|
||||
|
||||
### Resource
|
||||
### 资源
|
||||
|
||||
Wechaty has already held lots of talks and got a lot of blogs in the past years; here are all of the wechaty resources:
|
||||
过去几年,Wechaty 已举办大量分享并收获诸多博客文章;以下是全部 Wechaty 资源:
|
||||
|
||||
- :video_camera: [Youtube Playlist: Watch all of the talk videos related with Wechaty](https://www.youtube.com/playlist?list=PL8hd9KDTdarDXf_Rxtr8meKhxtgcXMInh)
|
||||
- :page_with_curl: [Full Docs](https://wechaty.js.org/)
|
||||
- :bulb: [Blog: See how developers use wechaty to build fantastic projects!](https://wechaty.github.io/)
|
||||
- :beginner: [Wechaty-Getting-Started:Wechaty Starter Project Template that Works Out-of-the-Box](https://github.com/wechaty/wechaty-getting-started)
|
||||
- :tada: [Wechaty Contributor List: Thanks for their contribution!](https://github.com/wechaty/wechaty/wiki/Contributors)
|
||||
- :gift: [Juzibot Support Wechaty: Know everything about Wechaty](https://github.com/juzibot/Welcome/wiki/Everything-about-Wechaty)
|
||||
- :video_camera: [Youtube Playlist:观看所有与 Wechaty 相关的演讲视频](https://www.youtube.com/playlist?list=PL8hd9KDTdarDXf_Rxtr8meKhxtgcXMInh)
|
||||
- :page_with_curl: [完整文档](https://wechaty.js.org/)
|
||||
- :bulb: [博客:看看开发者如何用 wechaty 打造精彩项目!](https://wechaty.github.io/)
|
||||
- :beginner: [Wechaty-Getting-Started:开箱即用的 Wechaty 入门项目模板](https://github.com/wechaty/wechaty-getting-started)
|
||||
- :tada: [Wechaty 贡献者名单:感谢他们的贡献!](https://github.com/wechaty/wechaty/wiki/Contributors)
|
||||
- :gift: [Juzibot Support Wechaty:了解关于 Wechaty 的一切](https://github.com/juzibot/Welcome/wiki/Everything-about-Wechaty)
|
||||
|
||||
## :rocket: The World's Shortest ChatBot Code: 6 lines of JavaScript
|
||||
## :rocket: 全球最短的 ChatBot 代码:6 行 JavaScript
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -109,29 +115,29 @@ wechaty
|
||||
wechaty.start()
|
||||
```
|
||||
|
||||
> **Notice: Wechaty requires Node.js version >= 16**
|
||||
> **注意:Wechaty 需要 Node.js 版本 >= 16**
|
||||
|
||||
This bot can log all messages to the console after login by the scan.
|
||||
扫码登录后,该机器人可将所有消息记录到控制台。
|
||||
|
||||
You can find Wechaty's Official Examples at [examples/ding-dong-bot.ts](examples/ding-dong-bot.ts) and more from our [Example Directory](https://github.com/Wechaty/wechaty-getting-started/blob/main/examples/).
|
||||
你可以在 [examples/ding-dong-bot.ts](examples/ding-dong-bot.ts) 找到 Wechaty 官方示例,更多示例见我们的 [示例目录](https://github.com/Wechaty/wechaty-getting-started/blob/main/examples/).
|
||||
|
||||
## :checkered_flag: Requirements
|
||||
## :checkered_flag: 环境要求
|
||||
|
||||
1. Node.js version 16+
|
||||
1. NPM version 7+
|
||||
1. TypeScript version 4.4+
|
||||
1. Node.js 版本 16+
|
||||
1. NPM 版本 7+
|
||||
1. TypeScript 版本 4.4+
|
||||
|
||||
## Getting Started
|
||||
## 快速入门
|
||||
|
||||
[](https://nodejs.org/)
|
||||
|
||||
- Wechaty Starter Repository - <https://github.com/wechaty/wechaty-getting-started>
|
||||
- Wechaty 入门仓库(Starter Repository)- <https://github.com/wechaty/wechaty-getting-started>
|
||||
|
||||
We have a Wechaty starter repository for beginners with the simplest setting. It will be **work** out-of-the-box after you `clone` & `npm install` & `npm start`.
|
||||
我们为初学者提供了一个配置最简单的 Wechaty 入门仓库。在你完成 `clone` & `npm install` & `npm start` 后,它将**开箱即用(work)**。
|
||||
|
||||
If you are new to Wechaty and want to try it the first time, we'd like to strong recommend you starting from this repository, and using it as your starter template for your project.
|
||||
如果你是 Wechaty 新手并想首次尝试,我们强烈建议你从这个仓库开始,并将其作为你项目的入门模板。
|
||||
|
||||
Otherwise, please saved the above _The World's Shortest ChatBot Code: 6 lines of JavaScript_ example to a file named `bot.js` before you can use either NPM or Docker to run it.
|
||||
否则,请先将上述 _世界上最短的聊天机器人代码:6 行 JavaScript_ 示例保存到名为 `bot.js` 的文件中,然后才能使用 NPM 或 Docker 运行。
|
||||
|
||||
### 1. Npm
|
||||
|
||||
@@ -155,35 +161,35 @@ node bot.js
|
||||
[](https://hub.docker.com/r/wechaty/wechaty/)
|
||||
[](https://microbadger.com/#/images/wechaty/wechaty)
|
||||
|
||||
- Wechaty Starter Repository for Docker - <https://github.com/wechaty/docker-wechaty-getting-started>
|
||||
- Wechaty Docker 入门仓库 - <https://github.com/wechaty/docker-wechaty-getting-started>
|
||||
|
||||
> Wechaty Docker supports both JavaScript and TypeScript. To use TypeScript just write in TypeScript and save with extension name `.ts`, no need to compile because we use `ts-node` to run it.
|
||||
> Wechaty Docker 同时支持 JavaScript 和 TypeScript。要使用 TypeScript,只需用 TypeScript 编写并以扩展名 `.ts` 保存,无需编译,因为我们使用 `ts-node` 来运行。
|
||||
|
||||
2.1. Run JavaScript
|
||||
2.1. 运行 JavaScript
|
||||
|
||||
```shell
|
||||
# for JavaScript
|
||||
docker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.js
|
||||
```
|
||||
|
||||
2.2. Run TypeScript
|
||||
2.2. 运行 TypeScript
|
||||
|
||||
```shell
|
||||
# for TypeScript
|
||||
docker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.ts
|
||||
```
|
||||
|
||||
> Learn more about Wechaty Docker at [Wiki:Docker](https://github.com/Wechaty/wechaty/wiki/Docker).
|
||||
> 在 [Wiki:Docker](https://github.com/Wechaty/wechaty/wiki/Docker). 了解更多 Wechaty Docker 信息
|
||||
|
||||
### 3. Switch Protocol(Puppet)
|
||||
### 3. 切换协议(Puppet)
|
||||
|
||||
Wechaty is very powerful that it can run over different protocols. You can specify the protocol by set the environment variable `WECHATY_PUPPET` to different puppet provider.
|
||||
Wechaty 功能强大,可在不同协议上运行。你可以通过将环境变量 `WECHATY_PUPPET` 设置为不同的 puppet 提供商(puppet provider)来指定协议。
|
||||
|
||||
If you cannot use Web protocol, you can apply other protocols following the instruction here: <https://github.com/wechaty/wechaty/wiki/Support-Developers> We provide free token to support developers build a valuable WeChat chatbot.
|
||||
如果你无法使用 Web 协议,可以按照此处的说明申请其他协议:<https://github.com/wechaty/wechaty/wiki/Support-Developers> 我们提供免费 token,以支持开发者构建有价值的微信聊天机器人。
|
||||
|
||||
Currently we support the following [puppet providers](https://wechaty.js.org/docs/puppet-services/) :
|
||||
目前我们支持以下 [puppet 提供商](https://wechaty.js.org/docs/puppet-services/) :
|
||||
|
||||
| Protocol | Puppet Provider | Environment Variable |
|
||||
| 协议 | Puppet 提供商 | 环境变量 |
|
||||
| --- | --- | --- |
|
||||
| Web | [PuppetPuppeteer](https://github.com/wechaty/wechaty-puppet-puppeteer) | `export WECHATY_PUPPET=wechaty-puppet-puppeteer` |
|
||||
| Windows | [PuppetWorkPro](https://github.com/RPAChat/workpro-getting-started) | `export WECHATY_PUPPET=wechaty-puppet-service` |
|
||||
@@ -198,160 +204,160 @@ Currently we support the following [puppet providers](https://wechaty.js.org/doc
|
||||
| Mac | ~~PuppetMacpro~~ **DEPRECATED** | `export WECHATY_PUPPET=wechaty-puppet-macpro` |
|
||||
| Windows | ~~PuppetWxwork~~ **DEPRECATED** | `export WECHATY_PUPPET=wechaty-puppet-service` |
|
||||
|
||||
Learn more about Wechaty Puppet from the Puppet Wiki:
|
||||
在 Puppet Wiki 中了解更多 Wechaty Puppet 信息:
|
||||
|
||||
1. Puppet Directory: <https://github.com/Wechaty/wechaty-puppet/wiki/Directory>
|
||||
1. Puppet Compatibility: <https://github.com/Wechaty/wechaty-puppet/wiki/Compatibility>
|
||||
1. Puppet 目录:<https://github.com/Wechaty/wechaty-puppet/wiki/Directory>
|
||||
1. Puppet 兼容性:<https://github.com/Wechaty/wechaty-puppet/wiki/Compatibility>
|
||||
|
||||
## :guitar: API
|
||||
|
||||
Read the Full Documentation at [Wechaty Official API Reference](https://wechaty.github.io/wechaty/)
|
||||
阅读完整文档:[Wechaty 官方 API 参考](https://wechaty.github.io/wechaty/)
|
||||
|
||||
### 1 Class `Wechaty`
|
||||
|
||||
Main bot class.
|
||||
主机器人类。
|
||||
|
||||
A `Bot` is a Wechaty instance that control a specific [wechaty-puppet](https://wechaty.js.org/docs/specifications/puppet/).
|
||||
`Bot` 是一个 Wechaty 实例,用于控制特定的 [wechaty-puppet](https://wechaty.js.org/docs/specifications/puppet/).
|
||||
|
||||
- `new Wechaty(options?: WechatyOptions)`
|
||||
1. `options.name?: string` the name of this bot(optional)
|
||||
2. `options.puppet?: string` select which puppet provider we want to use. must be one of the:
|
||||
1. [wechaty-puppet-wechat](https://github.com/Wechaty/wechaty-puppet-wechat) - Angular Hook for Web Wechat
|
||||
2. [wechaty-puppet-wechat4u](https://github.com/Wechaty/wechaty-puppet-wechat4u) - HTTP API for Web Wechat
|
||||
3. [wechaty-puppet-padpro](https://github.com/botorange/wechaty-puppet-padpro) - iPad App Protocol
|
||||
4. [wechaty-puppet-ioscat](https://github.com/linyimin-bupt/wechaty-puppet-ioscat) - iPhone App Hook
|
||||
5. [wechaty-puppet-mock](https://github.com/Wechaty/wechaty-puppet-mock) - Mock for Testing
|
||||
3. `options.puppetOptions?: PuppetOptions` options for the puppet provider.
|
||||
1. `options.name?: string` 该机器人的名称(可选)
|
||||
2. `options.puppet?: string` 选择要使用的 puppet 提供商,必须是以下之一:
|
||||
1. [wechaty-puppet-wechat](https://github.com/Wechaty/wechaty-puppet-wechat) - Web 微信的 Angular Hook
|
||||
2. [wechaty-puppet-wechat4u](https://github.com/Wechaty/wechaty-puppet-wechat4u) - Web 微信的 HTTP API
|
||||
3. [wechaty-puppet-padpro](https://github.com/botorange/wechaty-puppet-padpro) - iPad 应用协议
|
||||
4. [wechaty-puppet-ioscat](https://github.com/linyimin-bupt/wechaty-puppet-ioscat) - iPhone 应用 Hook
|
||||
5. [wechaty-puppet-mock](https://github.com/Wechaty/wechaty-puppet-mock) - 用于测试的 Mock
|
||||
3. `options.puppetOptions?: PuppetOptions` puppet 提供商的选项。
|
||||
|
||||
| Wechaty | API | Description |
|
||||
| Wechaty | API | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| event | [`login`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit after bot login full successful |
|
||||
| event | [`logout`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit after the bot log out |
|
||||
| event | [`friendship`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when someone sends bot a friend request|
|
||||
| event | [`message`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when there's a new message |
|
||||
| event | [`room-join`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when anyone join any room |
|
||||
| event | [`room-topic`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when someone change room topic |
|
||||
| event | [`room-leave`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when anyone leave the room |
|
||||
| event | [`room-invite`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when there is a room invitation |
|
||||
| event | [`scan`](https://wechaty.github.io/wechaty/#Wechaty+on) | emit when the bot needs to show you a QR Code for scanning |
|
||||
| method | [`start(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+start) | start the bot |
|
||||
| method | [`stop(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+stop) | stop the bot |
|
||||
| method | [`logonoff(): boolean`](https://wechaty.github.io/wechaty/#Wechaty+logonoff) | bot login status |
|
||||
| method | [`logout(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+logout) | logout the bot |
|
||||
| method | [`currentUser(): ContactSelf`](https://wechaty.github.io/wechaty/#Wechaty+currentUser) | get the login-ed bot contact |
|
||||
| method | [`say(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+say) | let bot say `text` to itself |
|
||||
| event | [`login`](https://wechaty.github.io/wechaty/#Wechaty+on) | 机器人完全登录成功后触发 |
|
||||
| event | [`logout`](https://wechaty.github.io/wechaty/#Wechaty+on) | 机器人登出后触发 |
|
||||
| event | [`friendship`](https://wechaty.github.io/wechaty/#Wechaty+on) | 有人向机器人发送好友请求时触发|
|
||||
| event | [`message`](https://wechaty.github.io/wechaty/#Wechaty+on) | 有新消息时触发 |
|
||||
| event | [`room-join`](https://wechaty.github.io/wechaty/#Wechaty+on) | 有人加入任何群聊时触发 |
|
||||
| event | [`room-topic`](https://wechaty.github.io/wechaty/#Wechaty+on) | 有人修改群聊主题时触发 |
|
||||
| event | [`room-leave`](https://wechaty.github.io/wechaty/#Wechaty+on) | 有人离开群聊时触发 |
|
||||
| event | [`room-invite`](https://wechaty.github.io/wechaty/#Wechaty+on) | 收到群聊邀请时触发 |
|
||||
| event | [`scan`](https://wechaty.github.io/wechaty/#Wechaty+on) | 机器人需要显示供扫描的二维码时触发 |
|
||||
| method | [`start(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+start) | 启动机器人 |
|
||||
| method | [`stop(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+stop) | 停止机器人 |
|
||||
| method | [`logonoff(): boolean`](https://wechaty.github.io/wechaty/#Wechaty+logonoff) | 机器人登录状态 |
|
||||
| method | [`logout(): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+logout) | 登出机器人 |
|
||||
| method | [`currentUser(): ContactSelf`](https://wechaty.github.io/wechaty/#Wechaty+currentUser) | 获取已登录的机器人联系人 |
|
||||
| method | [`say(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#Wechaty+say) | 让机器人向自己发送 `text` |
|
||||
|
||||
### 2 Class `Contact`
|
||||
|
||||
All wechat contacts(friends/non-friends) will be encapsulated as a Contact.
|
||||
所有微信联系人(好友/非好友)都将封装为 Contact。
|
||||
|
||||
| Contact | API | Description |
|
||||
| Contact | API | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| static | [`find(query: string): Promise<null \| Contact>`](https://wechaty.github.io/wechaty/#Contact.find) | find contact by name or alias, if the result more than one, return the first one. |
|
||||
| static | [`findAll(query: string): Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Contact.findAll) | find contact by `name` or `alias` |
|
||||
| static | [`load(query: string): Contact`](https://wechaty.github.io/wechaty/#Contact.load) | get contact by id |
|
||||
| property | `id: readonly string` | get contact id |
|
||||
| method | [`sync(): Promise<void>`](https://wechaty.github.io/wechaty/#Contact+sync) | force reload data for contact , sync data from lowlevel API again|
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Contact+say) | send text, Contact, or file to contact, return the message which the bot sent (only `puppet-padplus` supported). |
|
||||
| method | [`self(): boolean`](https://wechaty.github.io/wechaty/#Contact+self) | check if contact is self |
|
||||
| method | [`name(): string`](https://wechaty.github.io/wechaty/#Contact+name) | get the name from a contact |
|
||||
| method | [`alias(): Promise<string>`](https://wechaty.github.io/wechaty/#Contact+alias) | get the alias for a contact |
|
||||
| method | [`alias(newAlias: string): Promise<void>`](https://wechaty.github.io/wechaty/#Contact+alias) | set or delete the alias for a contact |
|
||||
| method | [`friend(): boolean`](https://wechaty.github.io/wechaty/#Contact+friend) | check if contact is friend |
|
||||
| method | [`type(): ContactType`](https://wechaty.github.io/wechaty/#Contact+type) | return the type of the Contact |
|
||||
| method | [`province(): string`](https://wechaty.github.io/wechaty/#Contact+province) | get the region 'province' from a contact |
|
||||
| method | [`city(): string`](https://wechaty.github.io/wechaty/#Contact+city) | get the region 'city' from a contact |
|
||||
| method | [`avatar(): Promise<FileBox>`](https://wechaty.github.io/wechaty/#Contact+avatar) | get avatar picture file stream |
|
||||
| method | [`gender(): ContactGender`](https://wechaty.github.io/wechaty/#Contact+gender) | get gender from a contact |
|
||||
| static | [`find(query: string): Promise<null \| Contact>`](https://wechaty.github.io/wechaty/#Contact.find) | 按名称或备注查找联系人,若结果多于一个则返回第一个。 |
|
||||
| static | [`findAll(query: string): Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Contact.findAll) | 通过 `name` 或 `alias` 查找联系人 |
|
||||
| static | [`load(query: string): Contact`](https://wechaty.github.io/wechaty/#Contact.load) | 通过 id 获取联系人 |
|
||||
| property | `id: readonly string` | 获取联系人 id |
|
||||
| method | [`sync(): Promise<void>`](https://wechaty.github.io/wechaty/#Contact+sync) | 强制重新加载联系人数据,再次从底层 API 同步数据|
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Contact+say) | 向联系人发送文本、Contact 或文件,返回机器人发送的消息(仅支持 `puppet-padplus`)。 |
|
||||
| method | [`self(): boolean`](https://wechaty.github.io/wechaty/#Contact+self) | 检查联系人是否为自身 |
|
||||
| method | [`name(): string`](https://wechaty.github.io/wechaty/#Contact+name) | 获取联系人姓名 |
|
||||
| method | [`alias(): Promise<string>`](https://wechaty.github.io/wechaty/#Contact+alias) | 获取联系人备注 |
|
||||
| method | [`alias(newAlias: string): Promise<void>`](https://wechaty.github.io/wechaty/#Contact+alias) | 设置或删除联系人备注 |
|
||||
| method | [`friend(): boolean`](https://wechaty.github.io/wechaty/#Contact+friend) | 检查联系人是否为好友 |
|
||||
| method | [`type(): ContactType`](https://wechaty.github.io/wechaty/#Contact+type) | 返回 Contact 的类型 |
|
||||
| method | [`province(): string`](https://wechaty.github.io/wechaty/#Contact+province) | 从联系人获取地区「省份」 |
|
||||
| method | [`city(): string`](https://wechaty.github.io/wechaty/#Contact+city) | 从联系人获取地区「城市」 |
|
||||
| method | [`avatar(): Promise<FileBox>`](https://wechaty.github.io/wechaty/#Contact+avatar) | 获取头像图片文件流 |
|
||||
| method | [`gender(): ContactGender`](https://wechaty.github.io/wechaty/#Contact+gender) | 获取联系人性别 |
|
||||
|
||||
#### 2.1 Class `ContactSelf`
|
||||
#### 2.1 类 `ContactSelf`
|
||||
|
||||
Class `ContactSelf` is extended from `Contact`.
|
||||
类 `ContactSelf` 继承自 `Contact`。
|
||||
|
||||
| ContactSelf | API | Description |
|
||||
| ContactSelf | API | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| method | [`avatar(file: FileBox): Promise<void>`](https://wechaty.github.io/wechaty/#ContactSelf+avatar) | set avatar for bot |
|
||||
| method | [`qrcode(): Promise<string>`](https://wechaty.github.io/wechaty/#ContactSelf+qrcode) | get qrcode for bot |
|
||||
| method | [`signature(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#ContactSelf+signature) | set signature for bot |
|
||||
| method | [`avatar(file: FileBox): Promise<void>`](https://wechaty.github.io/wechaty/#ContactSelf+avatar) | 为机器人设置头像 |
|
||||
| method | [`qrcode(): Promise<string>`](https://wechaty.github.io/wechaty/#ContactSelf+qrcode) | 获取机器人的二维码 |
|
||||
| method | [`signature(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#ContactSelf+signature) | 为机器人设置个性签名 |
|
||||
|
||||
#### 2.2 Class `Friendship`
|
||||
#### 2.2 类 `Friendship`
|
||||
|
||||
Send, receive friend request, and friend confirmation events.
|
||||
发送、接收好友请求及好友确认相关事件。
|
||||
|
||||
| Friendship | API | Description |
|
||||
| Friendship | API | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| static | [`add(contact: Contact, hello?: string): Promise<void>`](https://wechaty.github.io/wechaty/#Friendship.add) | send a friend invitation to contact |
|
||||
| method | [`accept(): Promise<void>`](https://wechaty.github.io/wechaty/#Friendship+accept) | accept Friend Request |
|
||||
| method | [`hello(): string`](https://wechaty.github.io/wechaty/#Friendship+hello) | get the hello string from a friendship invitation |
|
||||
| method | [`contact(): Contact`](https://wechaty.github.io/wechaty/#Friendship+contact) | get the contact from friendship |
|
||||
| method | [`type(): FriendshipType`](https://wechaty.github.io/wechaty/#Friendship+type) | return the Friendship Type(unknown, confirm, receive, verify) |
|
||||
| static | [`add(contact: Contact, hello?: string): Promise<void>`](https://wechaty.github.io/wechaty/#Friendship.add) | 向联系人发送好友邀请 |
|
||||
| method | [`accept(): Promise<void>`](https://wechaty.github.io/wechaty/#Friendship+accept) | 接受好友请求 |
|
||||
| method | [`hello(): string`](https://wechaty.github.io/wechaty/#Friendship+hello) | 从好友邀请中获取问候语字符串 |
|
||||
| method | [`contact(): Contact`](https://wechaty.github.io/wechaty/#Friendship+contact) | 从好友关系中获取联系人 |
|
||||
| method | [`type(): FriendshipType`](https://wechaty.github.io/wechaty/#Friendship+type) | 返回好友类型(unknown、confirm、receive、verify) |
|
||||
|
||||
### 3 Class `Message`
|
||||
### 3 类 `Message`
|
||||
|
||||
All wechat messages will be encapsulated as a Message.
|
||||
所有微信消息都将封装为 Message。
|
||||
|
||||
| Message | API | Description |
|
||||
| Message | API | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| static | [`find(query: string): Promise<null \| Message>`](https://wechaty.github.io/wechaty/#Message.find) | find message in cache and return the first one |
|
||||
| static | [`findAll(query: string): Promise<Message[]>`](https://wechaty.github.io/wechaty/#Message.findAll) | find messages in cache, return a message list |
|
||||
| method | [`from(): Contact`](https://wechaty.github.io/wechaty/#Message+from) | get the sender from a message |
|
||||
| method | [`to(): Contact`](https://wechaty.github.io/wechaty/#Message+to) | get the destination of the message |
|
||||
| method | [`room(): null \| Room`](https://wechaty.github.io/wechaty/#Message+room) | get the room from the message.(If the message is not in a room, then will return `null`) |
|
||||
| method | [`text(): string`](https://wechaty.github.io/wechaty/#Message+text) | get the text content of the message |
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Message+say) | reply a Text, Media File , or contact message to the sender, return the message which the bot sent (only `puppet-padplus` supported). |
|
||||
| method | [`type(): MessageType`](https://wechaty.github.io/wechaty/#Message+type) | get the type from the message |
|
||||
| method | [`self(): boolean`](https://wechaty.github.io/wechaty/#Message+self) | check if a message is sent by self |
|
||||
| method | [`mention(): Contact[]`](https://wechaty.github.io/wechaty/#Message+mention) | get message mentioned contactList. |
|
||||
| method | [`mentionSelf(): boolean`](https://wechaty.github.io/wechaty/#Message+mentionSelf) | check if a message is mention self |
|
||||
| method | [`forward(to: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Message+forward) | Forward the received message |
|
||||
| method | [`age(): number`](https://wechaty.github.io/wechaty/#Message+age) | the number of seconds since it has been created |
|
||||
| method | [`date(): Date`](https://wechaty.github.io/wechaty/#Message+date) | the time it was created |
|
||||
| method | [`toFileBox(): Promise<FileBox>`](https://wechaty.github.io/wechaty/#Message+toFileBox) | extract the Media File from the Message, and put it into the FileBox. |
|
||||
| method | [`toContact(): Promise<Contact>`](https://wechaty.github.io/wechaty/#Message+toContact) | get Share Card of the Message |
|
||||
| static | [`find(query: string): Promise<null \| Message>`](https://wechaty.github.io/wechaty/#Message.find) | 在缓存中查找消息并返回第一条 |
|
||||
| static | [`findAll(query: string): Promise<Message[]>`](https://wechaty.github.io/wechaty/#Message.findAll) | 在缓存中查找消息,返回消息列表 |
|
||||
| method | [`from(): Contact`](https://wechaty.github.io/wechaty/#Message+from) | 从消息中获取发送者 |
|
||||
| method | [`to(): Contact`](https://wechaty.github.io/wechaty/#Message+to) | 获取消息的目标对象 |
|
||||
| method | [`room(): null \| Room`](https://wechaty.github.io/wechaty/#Message+room) | 从消息中获取群聊。(如果消息不在群聊中,则返回 `null`) |
|
||||
| method | [`text(): string`](https://wechaty.github.io/wechaty/#Message+text) | 获取消息的文本内容 |
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Message+say) | 向发送者回复文本、媒体文件或联系人消息,返回机器人发送的消息(仅支持 `puppet-padplus`)。 |
|
||||
| method | [`type(): MessageType`](https://wechaty.github.io/wechaty/#Message+type) | 从消息中获取类型 |
|
||||
| method | [`self(): boolean`](https://wechaty.github.io/wechaty/#Message+self) | 检查消息是否由自己发送 |
|
||||
| method | [`mention(): Contact[]`](https://wechaty.github.io/wechaty/#Message+mention) | 获取消息中 @ 提及的联系人列表。 |
|
||||
| method | [`mentionSelf(): boolean`](https://wechaty.github.io/wechaty/#Message+mentionSelf) | 检查消息是否 @ 提及自己 |
|
||||
| method | [`forward(to: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Message+forward) | 转发收到的消息 |
|
||||
| method | [`age(): number`](https://wechaty.github.io/wechaty/#Message+age) | 自创建以来经过的秒数 |
|
||||
| method | [`date(): Date`](https://wechaty.github.io/wechaty/#Message+date) | 创建时间 |
|
||||
| method | [`toFileBox(): Promise<FileBox>`](https://wechaty.github.io/wechaty/#Message+toFileBox) | 从 Message 中提取媒体文件,并放入 FileBox。 |
|
||||
| method | [`toContact(): Promise<Contact>`](https://wechaty.github.io/wechaty/#Message+toContact) | 获取消息的分享卡片 |
|
||||
|
||||
### 4 Class `Room`
|
||||
### 4 类 `Room`
|
||||
|
||||
All wechat rooms(groups) will be encapsulated as a Room.
|
||||
所有微信群聊(群组)都将封装为 Room。
|
||||
|
||||
| Room | API | Description |
|
||||
| Room | API | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| static | [`create(contactList: Contact[], topic?: string): Promise<Room>`](https://wechaty.github.io/wechaty/#Room.create) | create a new room |
|
||||
| static | [`find(query: string): Promise<null \| Room>`](https://wechaty.github.io/wechaty/#Room.find) | Try to find a room by filter. If get many, return the first one. |
|
||||
| static | [`findAll(query: string): Promise<Room[]>`](https://wechaty.github.io/wechaty/#Room.findAll) | Find all contacts in a room |
|
||||
| static | [`load(query: string): Room`](https://wechaty.github.io/wechaty/#Room.load) | load room by room id |
|
||||
| static | [`create(contactList: Contact[], topic?: string): Promise<Room>`](https://wechaty.github.io/wechaty/#Room.create) | 创建新群聊 |
|
||||
| static | [`find(query: string): Promise<null \| Room>`](https://wechaty.github.io/wechaty/#Room.find) | 尝试通过筛选条件查找群聊。若找到多个,则返回第一个。 |
|
||||
| static | [`findAll(query: string): Promise<Room[]>`](https://wechaty.github.io/wechaty/#Room.findAll) | 查找群聊中的所有联系人 |
|
||||
| static | [`load(query: string): Room`](https://wechaty.github.io/wechaty/#Room.load) | 通过群聊 ID 加载群聊 |
|
||||
| property | `id: readonly string` | |
|
||||
| event | [`join`](https://wechaty.github.io/wechaty/#Room+on) | emit when anyone join any room |
|
||||
| event | [`topic`](https://wechaty.github.io/wechaty/#Room+on) | emit when someone change room topic |
|
||||
| event | [`leave`](https://wechaty.github.io/wechaty/#Room+on) | emit when anyone leave the room |
|
||||
| event | [`invite`](https://wechaty.github.io/wechaty/#Room+on) | emit when receive a room invitation |
|
||||
| method | [`sync(): <Promise<void>`](https://wechaty.github.io/wechaty/#Room+sync) | force reload data for room, sync data from lowlevel API again.
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Room+say) | Send text,media file, contact card, or text with mention @mention contact inside Room, return the message which the bot sent (only `puppet-padplus` supported). |
|
||||
| method | [`add(contact: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Room+add) | Add contact in a room |
|
||||
| method | [`del(contact: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Room+del) | Delete a contact from the room |
|
||||
| method | [`quit(): Promise<void>`](https://wechaty.github.io/wechaty/#Room+quit) | Bot quit the room itself |
|
||||
| method | [`topic(): Promise<string>`](https://wechaty.github.io/wechaty/#Room+topic) | GET topic from the room |
|
||||
| method | [`topic(newTopic: string): Promise<void>`](https://wechaty.github.io/wechaty/#Room+topic) | SET topic from the room |
|
||||
| method | [`announce(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#Room+announce) | SET/GET announce from the room |
|
||||
| method | [`qrcode(): Promise<string>`](https://wechaty.github.io/wechaty/#Room+qrcode) | Get QR Code of the Room from the room, which can be used as scan and join the room. |
|
||||
| method | [`alias(contact: Contact): Promise<string>`](https://wechaty.github.io/wechaty/#Room+alias) | Return contact's roomAlias in the room |
|
||||
| method | [`roomAlias(contact: Contact): Promise<string \| null>`](https://wechaty.github.io/wechaty/#Room+roomAlias) | Same as function alias |
|
||||
| method | [`has(contact: Contact): Promise<boolean>`](https://wechaty.github.io/wechaty/#Room+has) | Check if the room has member `contact` |
|
||||
| method | [`memberAll(query?: string): Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Room+memberAll) | Find all contacts or with specific name in a room |
|
||||
| method | [`member(query: string): Promise<null \| Contact>`](https://wechaty.github.io/wechaty/#Room+member) | Find all contacts in a room, if get many, return the first one. |
|
||||
| method | [`memberList():Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Room+memberList) | get all room member from the room |
|
||||
| method | [`owner(): null \| Contact`](https://wechaty.github.io/wechaty/#Room+owner) | Get room's owner from the room. |
|
||||
| event | [`join`](https://wechaty.github.io/wechaty/#Room+on) | 当有人加入任意群聊时触发 |
|
||||
| event | [`topic`](https://wechaty.github.io/wechaty/#Room+on) | 当有人修改群聊名称时触发 |
|
||||
| event | [`leave`](https://wechaty.github.io/wechaty/#Room+on) | 当有人离开群聊时触发 |
|
||||
| event | [`invite`](https://wechaty.github.io/wechaty/#Room+on) | 当收到群聊邀请时触发 |
|
||||
| method | [`sync(): <Promise<void>`](https://wechaty.github.io/wechaty/#Room+sync) | 强制重新加载群聊数据,再次从底层 API 同步数据。 |
|
||||
| method | [`say(text: string): Promise<void \| Message>`](https://wechaty.github.io/wechaty/#Room+say) | 在 Room 内发送文本、媒体文件、联系人名片,或带 @ 提及联系人的文本,返回机器人发送的消息(仅支持 `puppet-padplus`)。 |
|
||||
| method | [`add(contact: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Room+add) | 向群聊中添加联系人 |
|
||||
| method | [`del(contact: Contact): Promise<void>`](https://wechaty.github.io/wechaty/#Room+del) | 从群聊中删除联系人 |
|
||||
| method | [`quit(): Promise<void>`](https://wechaty.github.io/wechaty/#Room+quit) | 机器人自行退出群聊 |
|
||||
| method | [`topic(): Promise<string>`](https://wechaty.github.io/wechaty/#Room+topic) | 从群聊获取群名称 |
|
||||
| method | [`topic(newTopic: string): Promise<void>`](https://wechaty.github.io/wechaty/#Room+topic) | 设置群聊的群名称 |
|
||||
| method | [`announce(text: string): Promise<void>`](https://wechaty.github.io/wechaty/#Room+announce) | 设置/获取群聊公告 |
|
||||
| method | [`qrcode(): Promise<string>`](https://wechaty.github.io/wechaty/#Room+qrcode) | 从群聊获取群二维码,可用于扫码加入群聊。 |
|
||||
| method | [`alias(contact: Contact): Promise<string>`](https://wechaty.github.io/wechaty/#Room+alias) | 返回联系人在群聊中的群昵称(roomAlias) |
|
||||
| method | [`roomAlias(contact: Contact): Promise<string \| null>`](https://wechaty.github.io/wechaty/#Room+roomAlias) | 与 alias 函数相同 |
|
||||
| method | [`has(contact: Contact): Promise<boolean>`](https://wechaty.github.io/wechaty/#Room+has) | 检查群聊是否包含成员 `contact` |
|
||||
| method | [`memberAll(query?: string): Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Room+memberAll) | 查找群聊中的所有联系人,或按特定名称查找 |
|
||||
| method | [`member(query: string): Promise<null \| Contact>`](https://wechaty.github.io/wechaty/#Room+member) | 查找群聊中的联系人,若找到多个,则返回第一个。 |
|
||||
| method | [`memberList():Promise<Contact[]>`](https://wechaty.github.io/wechaty/#Room+memberList) | 从群聊获取所有群成员 |
|
||||
| method | [`owner(): null \| Contact`](https://wechaty.github.io/wechaty/#Room+owner) | 从群聊获取群主。 |
|
||||
|
||||
#### 4.1 Class `RoomInvitation`
|
||||
#### 4.1 类 `RoomInvitation`
|
||||
|
||||
Accept room invitation
|
||||
接受群聊邀请
|
||||
|
||||
| RoomInvitation | API | Description |
|
||||
| RoomInvitation | API | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| method | [`accept(): Promise<void>`](https://wechaty.github.io/wechaty/#RoomInvitation+accept) | accept Room Invitation |
|
||||
| method | [`inviter(): Contact`](https://wechaty.github.io/wechaty/#RoomInvitation+inviter) | get the inviter from room invitation |
|
||||
| method | [`roomTopic(): Promise<string>`](https://wechaty.github.io/wechaty/#RoomInvitation+inviter) | get the room topic from room invitation |
|
||||
| method | [`date(): Promise<Date>`](https://wechaty.github.io/wechaty/#RoomInvitation+date) | the time it was created |
|
||||
| method | [`age(): Promise<number>`](https://wechaty.github.io/wechaty/#RoomInvitation+age) | the number of seconds since it has been created |
|
||||
| method | [`accept(): Promise<void>`](https://wechaty.github.io/wechaty/#RoomInvitation+accept) | 接受群聊邀请 |
|
||||
| method | [`inviter(): Contact`](https://wechaty.github.io/wechaty/#RoomInvitation+inviter) | 从群聊邀请中获取邀请人 |
|
||||
| method | [`roomTopic(): Promise<string>`](https://wechaty.github.io/wechaty/#RoomInvitation+inviter) | 从群聊邀请中获取群名称 |
|
||||
| method | [`date(): Promise<Date>`](https://wechaty.github.io/wechaty/#RoomInvitation+date) | 创建时间 |
|
||||
| method | [`age(): Promise<number>`](https://wechaty.github.io/wechaty/#RoomInvitation+age) | 自创建以来经过的秒数 |
|
||||
|
||||
## TEST
|
||||
|
||||
@@ -361,19 +367,19 @@ Accept room invitation
|
||||
|
||||
[](https://snyk.io/test/github/Wechaty/wechaty)
|
||||
|
||||
Wechaty is fully automatically tested by unit and integration tests, with Continuous Integration & Continuous Delivery (CI/CD) support powered by CI like Travis, Shippable and Appveyor.
|
||||
Wechaty 通过单元测试和集成测试实现了全自动测试,并借助 Travis、Shippable、Appveyor 等 CI 提供持续集成与持续交付(Continuous Integration & Continuous Delivery,CI/CD)支持。
|
||||
|
||||
To test Wechaty, run:
|
||||
要测试 Wechaty,请运行:
|
||||
|
||||
```shell
|
||||
npm test
|
||||
```
|
||||
|
||||
Get to know more about the tests from [Wiki:Tests](https://github.com/Wechaty/wechaty/wiki/Tests)
|
||||
更多测试信息请参阅 [Wiki:Tests](https://github.com/Wechaty/wechaty/wiki/Tests)
|
||||
|
||||
## CREATING WECHATY PLUGIN
|
||||
## 创建 WECHATY 插件
|
||||
|
||||
Creating and publishing a Wechaty Plugin is simple. Simply expose your module as a function that takes 1 parameter: wechaty. When your plugin is imported by Wechaty, it will pass itself in as the argument, and so you are free to add any configuration that Wechaty supports.
|
||||
创建并发布 Wechaty 插件(Plugin)非常简单。只需将模块导出为一个接受 1 个参数 wechaty 的函数。当你的插件被 Wechaty 导入时,它会将自身作为参数传入,因此你可以自由添加 Wechaty 支持的任何配置。
|
||||
|
||||
```ts
|
||||
import { WechatyPlugin } from 'wechaty'
|
||||
@@ -383,19 +389,19 @@ export default const MyPlugin: WechatyPlugin = (wechaty: Wechaty) => {
|
||||
}
|
||||
```
|
||||
|
||||
The `config` exist so the user can pass in customizations to your Plugin. In documenting your Wechaty Plugin, you would lay out your supported config for the user.
|
||||
`config` 的存在是为了让用户可以向你的插件传入自定义配置。在编写 Wechaty 插件文档时,你应为用户列出所支持的配置项。
|
||||
|
||||
See:
|
||||
参见:
|
||||
|
||||
1. [Wechaty Plugin Support with KickOut Example #1939](https://github.com/wechaty/wechaty/issues/1939)
|
||||
1. [Wechaty Plugins Contrib](https://github.com/wechaty/wechaty-plugin-contrib)
|
||||
|
||||
## :pencil: RELEASE NOTES
|
||||
## :pencil: 发布说明
|
||||
|
||||
- [Latest Release](https://github.com/Wechaty/wechaty/releases/latest)(All releases [here](https://github.com/Wechaty/wechaty/releases))
|
||||
- [Latest Release](https://github.com/Wechaty/wechaty/releases/latest)(All 的版本发布见[此处](https://github.com/Wechaty/wechaty/releases))
|
||||
- [Changelog](https://github.com/Wechaty/wechaty/blob/main/CHANGELOG.md)
|
||||
|
||||
### :saxophone: Views Since Feb 15, 2019
|
||||
### :saxophone: 自 2019 年 2 月 15 日起的访问量
|
||||
|
||||
[](http://hits.dwyl.io/wechaty/wechaty)
|
||||
|
||||
@@ -403,66 +409,66 @@ See:
|
||||
|
||||
[](https://wechaty.js.org)
|
||||
|
||||
### :sparkles: Wechaty Badge
|
||||
### :sparkles: Wechaty 徽章
|
||||
|
||||
```markdown
|
||||
[](https://wechaty.js.org)
|
||||
```
|
||||
|
||||
Get more embed html/markdown code from [Wiki:Badge](https://github.com/wechaty/wechaty/wiki/Badge)
|
||||
更多嵌入用的 HTML/Markdown 代码请参阅 [Wiki:Badge](https://github.com/wechaty/wechaty/wiki/Badge)
|
||||
|
||||
### :star2: Projects Using Wechaty
|
||||
### :star2: 使用 Wechaty 的项目
|
||||
|
||||
1. [一个用CNN深度神经网络给图片评分的wechaty项目](https://github.com/huyingxi/wechaty_selfie)
|
||||
2. [Relay between Telegram and WeChat](https://github.com/Firaenix/TeleChatRelay)
|
||||
3. [A chat bot managing the HaoShiYou wechat groups run by volunteers of haoshiyou.org](https://github.com/xinbenlv/haoshiyou-bot)
|
||||
4. [An interactive chat bot to manage a TODO list](https://github.com/coderbunker/candobot)
|
||||
5. [Forward WeChat messages to telegram](https://github.com/luosheng/Wegram)
|
||||
2. [Telegram 与 WeChat 之间的消息中转](https://github.com/Firaenix/TeleChatRelay)
|
||||
3. [管理 haoshiyou.org 志愿者运营的 HaoShiYou 微信群的聊天机器人](https://github.com/xinbenlv/haoshiyou-bot)
|
||||
4. [用于管理 TODO 列表的交互式聊天机器人](https://github.com/coderbunker/candobot)
|
||||
5. [将微信消息转发到 Telegram](https://github.com/luosheng/Wegram)
|
||||
6. [koa与wechaty实现的微信小助手,可定时提醒与发消息设定定时任务](https://github.com/gengchen528/wechat-assistant)
|
||||
7. [Wechaty Pay - 让线上没有难做的生意](https://github.com/coderwhocode/wechaty-pay)
|
||||
8. [开源社的微信机器人项目](https://github.com/kaiyuanshe/wechat-robot)
|
||||
|
||||
Pull Request is welcome to add yours!
|
||||
欢迎提交 Pull Request 添加你的项目!
|
||||
|
||||
Learn more about Projects Using Wechaty at [Wiki:Projects Using Wechaty](https://github.com/wechaty/wechaty/wiki/Projects-Using-Wechaty)
|
||||
了解更多使用 Wechaty 的项目,请参阅 [Wiki:Projects Using Wechaty](https://github.com/wechaty/wechaty/wiki/Projects-Using-Wechaty)
|
||||
|
||||
## :innocent: Find a Good Server
|
||||
## :innocent: 选择合适的服务器
|
||||
|
||||
The best practice for running Wechaty Docker/NPM is using a VPS(Virtual Private Server) outside of China, which can save you hours of time because `npm install` and `docker pull` will run smoothly without any problem.
|
||||
运行 Wechaty Docker/NPM 的最佳实践是使用中国境外的 VPS(Virtual Private Server,虚拟专用服务器),这能为你节省大量时间,因为 `npm install` 和 `docker pull` 可以顺利运行,不会遇到任何问题。
|
||||
|
||||
The following VPS providers are used by the Wechaty team, and they worked perfectly in production. You can use the following link to get one in minutes. Also, doing this can support Wechaty because you are referred by us.
|
||||
以下 VPS 提供商已被 Wechaty 团队使用,并在生产环境中表现完美。你可以通过以下链接在几分钟内完成购买。此外,通过我们的推荐链接购买也能支持 Wechaty 项目。
|
||||
|
||||
| Location | Price | Ram | Payment | Provider |
|
||||
| 地区 | 价格 | 内存 | 支付方式 | 提供商 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Singapore | $5 | 512MB | Paypal | [DigitalOcean](https://m.do.co/c/01a54778df5c) |
|
||||
| Japan | $5 | 1GB | Paypal | [Linode](https://www.linode.com/?r=5fd2b713d711746bb5451111df0f2b6d863e9f63) |
|
||||
| Korea | $10 | 1GB | Alipay, Paypal | [Netdedi](https://www.netdedi.com/?affid=35) |
|
||||
| Singapore | $3.5 | 512MB | Alipay, Wechat | [Vultr](https://www.vultr.com/?ref=6986613) |
|
||||
|
||||
## :notes: See Also
|
||||
## :notes: 另请参阅
|
||||
|
||||
- [RelatedProject](https://github.com/Wechaty/wechaty/wiki/RelatedProject)
|
||||
|
||||
## :poop: The Story
|
||||
## :poop: 起源故事
|
||||
|
||||
In 2017 ...
|
||||
2017 年……
|
||||
|
||||
Huan's daily life/work depends on too much chat on wechat.
|
||||
Huan 的日常生活/工作极度依赖微信聊天。
|
||||
|
||||
- Almost 14,000 wechat friends in May 2014, before wechat restricts a total number of friends to 5,000.
|
||||
- Almost 400 wechat rooms, and most of them have more than 400 members.
|
||||
- 2014 年 5 月,微信好友接近 14,000 人——当时微信尚未将好友总数限制为 5,000。
|
||||
- 近 400 个微信群,其中大多数成员超过 400 人。
|
||||
|
||||
Can you imagine that? He was dying...
|
||||
你能想象吗?他快撑不住了……
|
||||
|
||||
So a tireless bot working for me 24x7 on wechat, monitoring/filtering the most important message is badly needed. For example, it highlights discussion which contains the KEYWORDS which he want to follow up(especially in a noisy room). ;-)
|
||||
因此,迫切需要一台在微信上 24x7 为我工作的不知疲倦的机器人,用于监控/筛选最重要的消息。例如,它会高亮包含他想跟进的关键词(KEYWORDS)的讨论(尤其在嘈杂的群里)。;-)
|
||||
|
||||
At last, It's built for huan's personal study purpose of Automatically Testing.
|
||||
最终,它是为 Huan 个人学习「自动化测试」(Automatically Testing)的目的而构建的。
|
||||
|
||||
## Stargazers over time
|
||||
## 随时间变化的 Star 数
|
||||
|
||||
[](https://starchart.cc/wechaty/wechaty)
|
||||
|
||||
## :two_hearts: Contributors
|
||||
## :two_hearts: 贡献者
|
||||
|
||||
[](https://github.com/Wechaty/wechaty/issues)
|
||||
[](https://github.com/Wechaty/wechaty/pulls)
|
||||
@@ -478,29 +484,29 @@ At last, It's built for huan's personal study purpose of Automatically Testing.
|
||||
[](https://sourcerer.io/fame/huan/wechaty/wechaty/links/6)
|
||||
[](https://sourcerer.io/fame/huan/wechaty/wechaty/links/7)
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
本项目的存在离不开所有贡献者的付出。[[参与贡献](CONTRIBUTING.md)]。
|
||||
|
||||
-----
|
||||
|
||||
[](https://github.com/Wechaty/wechaty/graphs/contributors)
|
||||
|
||||
## :sunglasses: Backers
|
||||
## :sunglasses: 支持者
|
||||
|
||||
[](#sunglasses-backers)
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/wechaty#backer)]
|
||||
感谢所有支持者!🙏 [[成为支持者](https://opencollective.com/wechaty#backer)]
|
||||
|
||||
[](https://opencollective.com/wechaty#backers)
|
||||
|
||||
## :smirk: Sponsors
|
||||
## :smirk: 赞助者
|
||||
|
||||
[](#smirk-sponsors)
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/wechaty#sponsor)]
|
||||
成为赞助者以支持本项目。你的 Logo 将显示在此处,并附带指向你网站的链接。[[成为赞助者](https://opencollective.com/wechaty#sponsor)]
|
||||
|
||||
[](https://opencollective.com/wechaty/#sponsor)
|
||||
|
||||
## Multi-language Wechaty
|
||||
## 多语言 Wechaty
|
||||
|
||||
[](https://github.com/wechaty/python-wechaty)
|
||||
[](https://github.com/wechaty/go-wechaty)
|
||||
@@ -509,47 +515,47 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
||||
[](https://github.com/wechaty/php-wechaty)
|
||||
[](https://github.com/wechaty/dotnet-wechaty)
|
||||
|
||||
- [Wechaty](https://github.com/wechaty/wechaty) - RPA SDK for Chatot Makers (TypeScript)
|
||||
- [Python Wechaty](https://github.com/wechaty/python-wechaty) - RPA SDK for Chatbot Makers written in Python
|
||||
- [Go Wechaty](https://github.com/wechaty/go-wechaty) - RPA SDK for Chatbot Makers written in Go
|
||||
- [Java Wechaty](https://github.com/wechaty/java-wechaty) - RPA SDK for Chatbot Makers written in Java(Kotlin)
|
||||
- [Scala Wechaty](https://github.com/wechaty/scala-wechaty) - RPA SDK for Chatbot Makers written in Scala
|
||||
- [PHP Wechaty](https://github.com/wechaty/php-wechaty) - RPA SDK for Chatbot Makers written in PHP
|
||||
- [.Net(C#) Wechaty](https://github.com/wechaty/dotnet-wechaty) - RPA SDK for Chatbot Makers written in .NET(C#)
|
||||
- [Wechaty](https://github.com/wechaty/wechaty) - 面向 Chatbot 开发者的 RPA SDK(TypeScript)
|
||||
- [Python Wechaty](https://github.com/wechaty/python-wechaty) - 使用 Python 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
- [Go Wechaty](https://github.com/wechaty/go-wechaty) - 使用 Go 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
- [Java Wechaty](https://github.com/wechaty/java-wechaty) - 使用 Java(Kotlin) 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
- [Scala Wechaty](https://github.com/wechaty/scala-wechaty) - 使用 Scala 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
- [PHP Wechaty](https://github.com/wechaty/php-wechaty) - 使用 PHP 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
- [.Net(C#) Wechaty](https://github.com/wechaty/dotnet-wechaty) - 使用 .NET(C#) 编写的面向 Chatbot 开发者的 RPA SDK
|
||||
|
||||
## History
|
||||
## 历史
|
||||
|
||||
### main v1.11 (Nov 22, 2021)
|
||||
### main v1.11(2021 年 11 月 22 日)
|
||||
|
||||
Working on reduxify the Wechaty ecosystem for applying the CQRS pattern.
|
||||
正在对 Wechaty 生态系统进行 reduxify,以应用 CQRS 模式。
|
||||
|
||||
### v1.10 (Nov 21, 2021)
|
||||
### v1.10(2021 年 11 月 21 日)
|
||||
|
||||
Second beta release of Wechaty, with all ecosystem npm modules with version v1.10 (wechaty-puppet, wechaty-puppet-service, etc)
|
||||
Wechaty 的第二次 beta 发布,生态系统中所有 npm 模块均为 v1.10 版本(wechaty-puppet、wechaty-puppet-service 等)
|
||||
|
||||
### v1.0 (Sep 2021)
|
||||
### v1.0(2021 年 9 月)
|
||||
|
||||
- Release v1.0 of Wechaty is the first beta release of Wechaty.
|
||||
- Wechaty v1.0 发布是 Wechaty 的首次 beta 发布。
|
||||
|
||||
### v0.69
|
||||
|
||||
1. v0.69: Supports ES Modules (with CJS dual support) ([#2232](https://github.com/wechaty/wechaty/issues/2232))
|
||||
1. v0.69:支持 ES Modules(同时兼容 CJS)([#2232](https://github.com/wechaty/wechaty/issues/2232))
|
||||
|
||||
### v0.68 (Aug 27, 2021)
|
||||
### v0.68(2021 年 8 月 27 日)
|
||||
|
||||
1. TLS support ([#2231](https://github.com/wechaty/wechaty/issues/2231))
|
||||
1. The latest CommonJS version
|
||||
1. 支持 TLS ([#2231](https://github.com/wechaty/wechaty/issues/2231))
|
||||
1. 最新的 CommonJS 版本
|
||||
|
||||
## Creators
|
||||
## 创建者
|
||||
|
||||
1. [Huan](https://github.com/huan) [(LinkedIn)](http://linkedin.com/in/huan42), 🐧 Tencent TVP of Chatbot・🤖 Chatie Architect・⭐️ GitHub Star・🚀 YC W19・🌐 Microsoft RD & AI MVP・🦾 Google ML GDE ・🤠 Serial Entrepreneur・🔥 Burner
|
||||
1. [Rui (李佳芮)](https://pre-angel.com/peoples/jiarui-li/), Microsoft AI MVP & RD, Co-founder & CEO of [Juzi.BOT](https://www.juzibot.com/) (YC W19 Alumni)
|
||||
1. [Huan](https://github.com/huan) [(LinkedIn)](http://linkedin.com/in/huan42), 🐧 腾讯 Chatbot TVP・🤖 Chatie 架构师・⭐️ GitHub Star・🚀 YC W19・🌐 Microsoft RD & AI MVP・🦾 Google ML GDE・🤠 连续创业者・🔥 Burner
|
||||
1. [Rui(李佳芮)](https://pre-angel.com/peoples/jiarui-li/), Microsoft AI MVP & RD,[Juzi.BOT](https://www.juzibot.com/) 联合创始人兼 CEO(YC W19 校友)
|
||||
|
||||
[](https://stackoverflow.com/users/1123955/huan)
|
||||
[](https://stackoverflow.com/users/1123955/huan)
|
||||
|
||||
## Cite Wechaty
|
||||
## 引用 Wechaty
|
||||
|
||||
To cite this project in publications:
|
||||
在出版物中引用本项目:
|
||||
|
||||
```bibtex
|
||||
@misc{Wechaty,
|
||||
@@ -562,8 +568,8 @@ To cite this project in publications:
|
||||
}
|
||||
```
|
||||
|
||||
## Copyright & License
|
||||
## 版权与许可证
|
||||
|
||||
- Code & Docs © 2016-now Huan, Rui, and Wechaty Community Contributors
|
||||
- Code released under the Apache-2.0 License
|
||||
- Docs released under Creative Commons
|
||||
- 代码与文档 © 2016-至今 Huan、Rui 及 Wechaty 社区贡献者
|
||||
- 代码基于 Apache-2.0 License 发布
|
||||
- 文档基于 Creative Commons 发布
|
||||
|
||||
Reference in New Issue
Block a user