提交 017fb2a3 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

clean hot-import example code

上级 c4dc528f
# HOT-IMPORT LISTENSER # HOT-IMPORT LISTENSER
**PR from @xinbenlv** ## PR From @xinbenlv
Hot import Wechaty listenser functions after change the source code without restart the program Hot import Wechaty listenser functions after change the source code without restart the program
...@@ -12,16 +12,20 @@ The hot-import is based on an npm package [hot-import](https://www.npmjs.com/pac ...@@ -12,16 +12,20 @@ The hot-import is based on an npm package [hot-import](https://www.npmjs.com/pac
Not to be confused by the directory `../hot-reload-bot` which is a hand written Not to be confused by the directory `../hot-reload-bot` which is a hand written
hot reload approach proposed by [Gcaufy](https://github.com/Gcaufy) hot reload approach proposed by [Gcaufy](https://github.com/Gcaufy)
## Run ## Run
```shell ```shell
docker run -t -i --rm --name wechaty --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js $ docker run -t -i --rm --name wechaty --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js
```
# Enable LOG
$ docker run -t -i --rm --name wechaty -e WECHATY_LOG=verbose --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js
```
Or Or
```shell ```shell
./run-hot-import-bot.sh $ ./run-hot-import-bot.sh
```
# Enable LOG
$ WECHATY_LOG=verbose ./run-hot-import-bot.sh
```
...@@ -21,6 +21,6 @@ export default async function onScan (url, code) { ...@@ -21,6 +21,6 @@ export default async function onScan (url, code) {
console.log(code, url) console.log(code, url)
if (code === 0) { if (code === 0) {
require('qrcode-terminal').generate(loginUrl) require('qrcode-terminal').generate(loginUrl, {small: true})
} }
} }
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
docker run -t -i --rm --name wechaty --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js docker run -t -i --rm --name wechaty -e WECHATY_LOG="$WECHATY_LOG" --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js
...@@ -113,7 +113,7 @@ console.log(` ...@@ -113,7 +113,7 @@ console.log(`
ATTENTION: This example is DEPRECATED. ATTENTION: This example is DEPRECATED.
Please see https://github.com/Chatie/wechaty/tree/master/examples/hot-reload-bot instead. Please see https://github.com/Chatie/wechaty/tree/master/examples/hot-import-bot instead.
`) `)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册