Skip to content

Commit

Permalink
1.13.12
Browse files Browse the repository at this point in the history
Fixed the bug where the system crashes upon receiving a message before successful startup
  • Loading branch information
atorber committed Mar 27, 2024
1 parent d052b72 commit 632e0fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ puppet-xp|wechat|npm install|

## HISTORY

### next v1.13.9
### v1.13.12

1. Fixed the bug where the system crashes upon receiving a message before successful startup

### v1.13.9

1. Add setting for contact remark
2. Optimize sample code
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-puppet-xp",
"version": "1.13.11",
"version": "1.13.12",
"description": "Puppet XP for Wechaty",
"type": "module",
"exports": {
Expand Down
8 changes: 7 additions & 1 deletion src/puppet-xp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class PuppetXp extends PUPPET.Puppet {

private selfInfo: any

private isReady = false

#sidecar?: WeChatSidecar
protected get sidecar (): WeChatSidecar {
return this.#sidecar!
Expand Down Expand Up @@ -150,6 +152,8 @@ class PuppetXp extends PUPPET.Puppet {

private async onAgentReady () {
log.verbose('PuppetXp', 'onAgentReady()')
this.isReady = true
this.emit('ready', this.selfInfo)
// const isLoggedIn = await this.sidecar.isLoggedIn()
// if (!isLoggedIn) {
// await this.sidecar.callLoginQrcode(false)
Expand Down Expand Up @@ -494,7 +498,9 @@ class PuppetXp extends PUPPET.Puppet {
}
} else {
this.messageStore[payload.id] = payload
this.emit('message', { messageId: payload.id })
if (this.isReady) {
this.emit('message', { messageId: payload.id })
}
}
}
} catch (e) {
Expand Down

0 comments on commit 632e0fa

Please sign in to comment.