-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #923 #935
Fix #923 #935
Conversation
Awesome! Could you please fix the CI linting error before we could merge it? |
ping @xinbenlv Please fix the linting error so that we could merge it, thanks! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change wechaty function to the latest one.
bot.start() | ||
.catch(e => { | ||
log.error('Bot', 'init() fail: %s', e) | ||
bot.quit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest wechaty function is stop()
, maybe we should change the latest one instead.
@@ -444,7 +444,7 @@ export class Wechaty extends EventEmitter implements Sayable { | |||
/** | |||
* Quit the bot | |||
* | |||
* @deprecated | |||
* @deprecated use stop() instead | |||
* @returns {Promise<void>} | |||
* @example | |||
* await bot.quit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await bot.stop()
finis((code, signal) => { | ||
const exitMsg = `Wechaty exit ${code} because of ${signal} ` | ||
console.log(exitMsg) | ||
bot.say(exitMsg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it should add bot.stop()
and process.exit(-1)
here, or chrome will restart again and again... and node cannot be quit.... see #978
ping @xinbenlv |
I am using this feature (hot-import) and start to experience some problem,
mostly due to the cache was not cleared and watch function not triggered,
so when I update code, it was not being refreshed. Have you experienced it?
zhuohuan, can you provide an example demonstrating how hot-import can load
a class inside of a module? (decouple from WeChaty)?
Thank you!
…On Wed, Nov 22, 2017 at 7:02 PM, Huan LI ***@***.***> wrote:
ping @xinbenlv <https://github.com/xinbenlv>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#935 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAnFRTzOR3mLRHdruCER0ag4olzx_xSeks5s5OA0gaJpZM4QKiya>
.
|
I think before we can solve this, it doesn't help much (and can mislead
people if we provide this example code for WeChaty)
…On Wed, Nov 22, 2017 at 7:37 PM, Zainan Victor Zhou ***@***.***> wrote:
I am using this feature (hot-import) and start to experience some problem,
mostly due to the cache was not cleared and watch function not triggered,
so when I update code, it was not being refreshed. Have you experienced it?
zhuohuan, can you provide an example demonstrating how hot-import can load
a class inside of a module? (decouple from WeChaty)?
Thank you!
On Wed, Nov 22, 2017 at 7:02 PM, Huan LI ***@***.***> wrote:
> ping @xinbenlv <https://github.com/xinbenlv>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#935 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AAnFRTzOR3mLRHdruCER0ag4olzx_xSeks5s5OA0gaJpZM4QKiya>
> .
>
|
I did not use hotImport lot but it always works fine with me. In order to import a class, you can have a look into https://github.com/zixia/hot-import/blob/bc380c8238d3f7e1d410fd21d5e404de4aa8760e/src/hot-import.spec.ts#L82 The unit tests & fixtures would help you understand the inside logic, and please file issue if you meet any bug. Thanks. |
do you have more updates on that please? Have you tried https://github.com/Chatie/wechaty/tree/master/example/hot-reload-bot? @zixia, what's the difference between the Thanks |
@suntong I had just written a new example of how to use hot-import feature which natively supported by Wechaty at here: https://github.com/Chatie/wechaty/tree/master/example/hot-import-bot Hope that could help you. @xinbenlv Please have a look at it too, I tested it and felt it works well. thanks. Good luck! |
ha, I see your new changes right in front of my eyes, from your own to @xinbenlv's PR. :-) So, @xinbenlv & @zixia, I looked at the https://github.com/Chatie/wechaty/blob/master/example/hot-import-bot/index.js and but can't find where |
Oh, it's now completely embedded into the core code so no external fiddling necessary. Cool. Ok, then, how to make use of the feature to load config files? Thx. |
@suntong Sorry it's only the hot-import for the module is supported by the core code. You still have to do load config files job by yourself. |
OK. I'll try hot-importing them myself via the API... thx. |
How do you start this demo, apart from running from docker? I tried both
thanks! |
Fixes #923