diff --git a/examples/hot-import-bot/README.md b/examples/hot-import-bot/README.md index 9ad805fd5cf4453b2170971d174f9b02c19ff1dc..b7569f6c556fc26c6cfdb4dc243adb1c0fc869c5 100644 --- a/examples/hot-import-bot/README.md +++ b/examples/hot-import-bot/README.md @@ -1,6 +1,6 @@ # HOT-IMPORT LISTENSER -**PR from @xinbenlv** +## PR From @xinbenlv 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 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) - ## Run - ```shell - docker run -t -i --rm --name wechaty --mount type=bind,source="$(pwd)",target=/bot zixia/wechaty index.js - ``` +```shell +$ 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 ```shell -./run-hot-import-bot.sh -``` +$ ./run-hot-import-bot.sh +# Enable LOG +$ WECHATY_LOG=verbose ./run-hot-import-bot.sh +``` diff --git a/examples/hot-import-bot/listeners/on-scan.js b/examples/hot-import-bot/listeners/on-scan.js index 49d5005f95cfbe1b7f4899988b82ab4eaf37c79c..daf1e1df8ef4f9fa51dac1c8134fb6293def1795 100644 --- a/examples/hot-import-bot/listeners/on-scan.js +++ b/examples/hot-import-bot/listeners/on-scan.js @@ -21,6 +21,6 @@ export default async function onScan (url, code) { console.log(code, url) if (code === 0) { - require('qrcode-terminal').generate(loginUrl) + require('qrcode-terminal').generate(loginUrl, {small: true}) } } diff --git a/examples/hot-import-bot/run-hot-import-bot.sh b/examples/hot-import-bot/run-hot-import-bot.sh index 05612907f843a28b60bcc04e48c03a4fff2e0221..827e444efbc32da76acd58929a8b16f33828f863 100755 --- a/examples/hot-import-bot/run-hot-import-bot.sh +++ b/examples/hot-import-bot/run-hot-import-bot.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash 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 diff --git a/examples/hot-reload-bot/index.js b/examples/hot-reload-bot/index.js index af7ad5ffa33350c7cb45e340a5f49e47ff3645cf..bff4a971f501050ce5ada226e368cb68765eeb7b 100644 --- a/examples/hot-reload-bot/index.js +++ b/examples/hot-reload-bot/index.js @@ -113,7 +113,7 @@ console.log(` 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. `)