Skip to content

Commit

Permalink
feat: 🎸 date in scan event
Browse files Browse the repository at this point in the history
  • Loading branch information
hcfw007 committed Jan 3, 2024
1 parent 8cf33fe commit c437c80
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"@chatie/eslint-config": "^1.0.4",
"@chatie/semver": "^0.4.7",
"@chatie/tsconfig": "^4.6.3",
"@juzi/wechaty-puppet": "^1.0.76",
"@juzi/wechaty-puppet": "^1.0.77",
"@juzi/wechaty-puppet-mock": "^1.0.1",
"@swc/core": "1.3.44",
"@swc/helpers": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/wechaty-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type WechatyEventListenerRoomLeave = (room: RoomInterface, leaverList:
type WechatyEventListenerRoomTopic = (room: RoomInterface, newTopic: string, oldTopic: string, changer: ContactInterface, date?: Date) => void | Promise<void>
type WechatyEventListenerRoomAnnounce = (room: RoomInterface, newAnnounce: string, changer: ContactInterface, oldAnnounce?: string, date?: Date) => void | Promise<void>
type WechatyEventListenerRoomOwner = (room: RoomInterface, newOwner: ContactInterface, oldOwner: ContactInterface) => void | Promise<void>
type WechatyEventListenerScan = (qrcode: string, status: PUPPET.types.ScanStatus, data: string, type: PUPPET.types.ScanType) => void | Promise<void>
type WechatyEventListenerScan = (qrcode: string, status: PUPPET.types.ScanStatus, data: string, type: PUPPET.types.ScanType, date: Date) => void | Promise<void>
type WechatyEventListenerStartStop = () => void | Promise<void>
type WechatyEventListenerContactTagAdd = (contact: ContactInterface, tagList: TagInterface[]) => void | Promise<void>
type WechatyEventListenerContactTagRemove = (contact: ContactInterface, tagList: TagInterface[]) => void | Promise<void>
Expand Down
3 changes: 2 additions & 1 deletion src/wechaty-mixins/puppet-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
case 'scan':
puppet.on('scan', async payload => {
this.__readyState.inactive(true)
this.emit('scan', payload.qrcode || '', payload.status, payload.data || '', payload.type || ScanType.Unknown)
const date = timestampToDate(Number(payload.timestamp) || 0)
this.emit('scan', payload.qrcode || '', payload.status, payload.data || '', payload.type || ScanType.Unknown, date)
})
break

Expand Down

0 comments on commit c437c80

Please sign in to comment.