wechaty-puppet-matrix 0.0.24 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,7 +207,12 @@ class PuppetMatrix extends PUPPET.Puppet {
207
207
  } as any)
208
208
  }, 5000)
209
209
  }
210
-
210
+ }))
211
+ this._client.on('expired', this.wrapAsync(async (expired: boolean) => {
212
+ if (expired) {
213
+ log.info(PRE, 'Token has expired')
214
+ void this.onStop()
215
+ }
211
216
  }))
212
217
  }
213
218
  addRunningPuppet(this)
@@ -434,6 +439,8 @@ class PuppetMatrix extends PUPPET.Puppet {
434
439
  private async _stopClient (): Promise<void> {
435
440
  this.__currentUserId = undefined
436
441
  this.__currentUserId = undefined
442
+ this._client?.destroy()
443
+ this._client = undefined
437
444
  if (this._cacheMgr) {
438
445
  log.info(PRE, 'colse cache')
439
446
  await this._cacheMgr.close()