@@ -41,7 +42,7 @@ See more at [Wiki:VoiceOfDeveloper](https://github.com/Chatie/wechaty/wiki/Voice
const{Wechaty}=require('wechaty')// import { Wechaty } from 'wechaty'
Wechaty.instance()// Global Instance
.on('scan',(qrcode,status)=>console.log(`Scan QR Code to login: ${status}\n${qrcode}`))
.on('scan',(qrcode,status)=>console.log(`Scan QR Code to login: ${status}\nhttps://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrcode)}`))
@@ -49,7 +50,7 @@ Wechaty.instance() // Global Instance
> **Notice: Wechaty requires Node.js version >= 10**
This bot can log all messages to the console.
This bot can log all messages to the console after login by scan.
You can find more examples from [Wiki](https://github.com/chatie/wechaty/wiki/Examples) and [Example Directory](https://github.com/chatie/wechaty/blob/master/examples/).
...
...
@@ -57,72 +58,52 @@ You can find more examples from [Wiki](https://github.com/chatie/wechaty/wiki/Ex
We have a Wechaty starter repository for beginners with the simplest setting. It will be **just works** after you `clone` & `npm install` & `npm start`.
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.
The above 15 minute video tutorial is a good start point if you are new to Wechaty.
Notice: The published versions have always passed the CI tests. We highly recommend running wechaty with the versions installed by docker or npm instead of the latest master branch unless you are prepared to deal with the broken code problems.
# create your first mybot.js file, you can copy/paste from the above "The World's Shortest ChatBot Code: 6 lines of JavaScript"
The **best practice** to use Wechaty is running with docker, because it's not only the most easy way to get started, but also protects you from the troubles of dependency problems.
> Wechaty Docker supports both JavaScript and TypeScript. To use TypeScript just write in TypeScript and save with extension name `.ts`.
Get to know more about Wechaty Docker at [Wiki:Docker](https://github.com/chatie/wechaty/wiki/Docker).
> 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.
1. Run JavaScript
```shell
$ docker run -ti--rm--volume="$(pwd)":/bot zixia/wechaty mybot.js # for JavaScript
...
# for JavaScript
docker run -ti--rm--volume="$(pwd)":/bot zixia/wechaty mybot.js
```
1. Run TypeScript
```shell
$ docker run -ti--rm--volume="$(pwd)":/bot zixia/wechaty mybot.ts # for TypeScript
.on('scan',(qrcode,status)=>console.log(`Scan QR Code to login: ${status}\nhttps://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrcode)}`))