Skip to content

Commit

Permalink
Merge pull request #79 from juzibot/fix/check-ready-after-login
Browse files Browse the repository at this point in the history
Fix/check ready after login
  • Loading branch information
hcfw007 authored Dec 19, 2023
2 parents 92f0e69 + a85b4d9 commit 826b81c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@juzi/wechaty",
"version": "1.0.84",
"version": "1.0.85",
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
"type": "module",
"exports": {
Expand Down
10 changes: 10 additions & 0 deletions src/wechaty-mixins/puppet-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
throw new Error('no contact found for id: ' + payload.contactId)
}
this.emit('login', contact)
const readyTimeout = setTimeout(() => {
if (this.puppet.readyIndicator.value()) {
this.emit('ready')
}
}, 15 * 1000)
puppet.once('ready', () => {
// if we got ready from puppet, we don't have to fire it here.
// it will be fired by ready listener
clearTimeout(readyTimeout)
})
} catch (e) {
this.emit('error', GError.from(e))
}
Expand Down

0 comments on commit 826b81c

Please sign in to comment.