@juzi/wechaty 1.0.73 → 1.0.75
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.
- package/dist/cjs/src/package-json.js +3 -3
- package/dist/cjs/src/schemas/wechaty-events.d.ts +4 -1
- package/dist/cjs/src/schemas/wechaty-events.d.ts.map +1 -1
- package/dist/cjs/src/schemas/wechaty-events.js.map +1 -1
- package/dist/cjs/src/user-modules/message.d.ts +3 -3
- package/dist/cjs/src/user-modules/message.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/message.js +14 -6
- package/dist/cjs/src/user-modules/message.js.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-base.d.ts +7 -7
- package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts +1 -1
- package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts +2 -2
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +5 -5
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +5 -5
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +6 -6
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +4 -4
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js +3 -2
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +1 -1
- package/dist/esm/src/package-json.js +3 -3
- package/dist/esm/src/schemas/wechaty-events.d.ts +4 -1
- package/dist/esm/src/schemas/wechaty-events.d.ts.map +1 -1
- package/dist/esm/src/schemas/wechaty-events.js.map +1 -1
- package/dist/esm/src/user-modules/message.d.ts +3 -3
- package/dist/esm/src/user-modules/message.d.ts.map +1 -1
- package/dist/esm/src/user-modules/message.js +14 -6
- package/dist/esm/src/user-modules/message.js.map +1 -1
- package/dist/esm/src/wechaty/wechaty-base.d.ts +7 -7
- package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts +1 -1
- package/dist/esm/src/wechaty-mixins/io-mixin.d.ts +2 -2
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +5 -5
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +5 -5
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +6 -6
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +4 -4
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js +3 -2
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +1 -1
- package/package.json +2 -2
- package/src/package-json.ts +3 -3
- package/src/schemas/wechaty-events.ts +3 -0
- package/src/user-modules/message.ts +14 -6
- package/src/wechaty-mixins/puppet-mixin.ts +3 -2
package/src/package-json.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { PackageJsonWechaty } from './config'
|
|
6
6
|
|
|
7
|
-
export const GIT_COMMIT_HASH: string = '
|
|
7
|
+
export const GIT_COMMIT_HASH: string = '6e9df753e465ef01b41f5a99a87b6c013f176a3e'
|
|
8
8
|
export const packageJson: PackageJsonWechaty = {
|
|
9
9
|
"name": "@juzi/wechaty",
|
|
10
|
-
"version": "1.0.
|
|
10
|
+
"version": "1.0.75",
|
|
11
11
|
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
@@ -139,7 +139,7 @@ export const packageJson: PackageJsonWechaty = {
|
|
|
139
139
|
"@chatie/eslint-config": "^1.0.4",
|
|
140
140
|
"@chatie/semver": "^0.4.7",
|
|
141
141
|
"@chatie/tsconfig": "^4.6.3",
|
|
142
|
-
"@juzi/wechaty-puppet": "^1.0.
|
|
142
|
+
"@juzi/wechaty-puppet": "^1.0.68",
|
|
143
143
|
"@juzi/wechaty-puppet-mock": "^1.0.1",
|
|
144
144
|
"@swc/core": "1.3.44",
|
|
145
145
|
"@swc/helpers": "^0.3.6",
|
|
@@ -73,6 +73,7 @@ type WechatyEventListenerTagGroup = (type: PUPPET.types.TagGroupEvent,
|
|
|
73
73
|
type WechatyEventListenerPostComment = (comment: PostInterface, post: PostInterface) => void | Promise<void>
|
|
74
74
|
type WechatyEventListenerPostTap = (post: PostInterface, contact: ContactInterface, type: PUPPET.types.Tap, tap: boolean, date?: Date) => void | Promise<void>
|
|
75
75
|
type WechatyEventListenerVerifyCode = (id: string, message: string, scene: PUPPET.types.VerifyCodeScene, status: PUPPET.types.VerifyCodeStatus) => void | Promise<void>
|
|
76
|
+
type WechatyEventListenerDirty = (id: string, type: PUPPET.types.Dirty) => void | Promise<void>
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* @desc Wechaty Class Event Type
|
|
@@ -261,6 +262,7 @@ interface WechatyEventListeners {
|
|
|
261
262
|
'post-comment' : WechatyEventListenerPostComment
|
|
262
263
|
'post-tap' : WechatyEventListenerPostTap
|
|
263
264
|
'verify-code' : WechatyEventListenerVerifyCode
|
|
265
|
+
'dirty' : WechatyEventListenerDirty
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
const WechatyEventEmitter = EventEmitter as any as new () => TypedEventEmitter<
|
|
@@ -302,6 +304,7 @@ export type {
|
|
|
302
304
|
WechatyEventListenerPostComment,
|
|
303
305
|
WechatyEventListenerPostTap,
|
|
304
306
|
WechatyEventListenerVerifyCode,
|
|
307
|
+
WechatyEventListenerDirty,
|
|
305
308
|
}
|
|
306
309
|
export {
|
|
307
310
|
WechatyEventEmitter,
|
|
@@ -996,16 +996,24 @@ class MessageMixin extends MixinBase implements SayableSayer {
|
|
|
996
996
|
/**
|
|
997
997
|
* Check if a message is mention self.
|
|
998
998
|
*
|
|
999
|
-
* @returns {
|
|
999
|
+
* @returns {boolean} - Return `true` for mention me.
|
|
1000
1000
|
* @example
|
|
1001
|
-
* if (
|
|
1001
|
+
* if (message.mentionSelf()) {
|
|
1002
1002
|
* console.log('this message were mentioned me! [You were mentioned] tip ([有人@我]的提示)')
|
|
1003
1003
|
* }
|
|
1004
1004
|
*/
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1005
|
+
mentionSelf (): boolean {
|
|
1006
|
+
if (this.payload?.roomId
|
|
1007
|
+
&& 'mentionIdList' in this.payload
|
|
1008
|
+
&& Array.isArray(this.payload.mentionIdList)
|
|
1009
|
+
) {
|
|
1010
|
+
const currentUserId = this.wechaty.puppet.currentUserId
|
|
1011
|
+
// const mentionList = await this.mentionList()
|
|
1012
|
+
const mentionIdList = this.payload.mentionIdList
|
|
1013
|
+
return mentionIdList.some(id => id === currentUserId)
|
|
1014
|
+
} else {
|
|
1015
|
+
return false
|
|
1016
|
+
}
|
|
1009
1017
|
}
|
|
1010
1018
|
|
|
1011
1019
|
/**
|
|
@@ -649,7 +649,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
649
649
|
const differences = diffPayload<PUPPET.payloads.Contact>(oldPayload, newPayload)
|
|
650
650
|
if (differences.length === 0) {
|
|
651
651
|
log.info('WechatyPuppetMixin', `got dirty for contact ${payloadId} but cannot find any difference. old payload: ${JSON.stringify(oldPayload)}, new payload: ${JSON.stringify(newPayload)}`)
|
|
652
|
-
|
|
652
|
+
break
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
const importantDifferences = differences.filter(ele => ele && ContactImportantFields.some(key => key === ele.key))
|
|
@@ -721,7 +721,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
721
721
|
|
|
722
722
|
if (differences.length === 0) {
|
|
723
723
|
log.info('WechatyPuppetMixin', `got dirty for room ${payloadId} but cannot find any difference. old payload: ${JSON.stringify(oldPayload)}, new payload: ${JSON.stringify(newPayload)}`)
|
|
724
|
-
|
|
724
|
+
break
|
|
725
725
|
}
|
|
726
726
|
|
|
727
727
|
const importantDifferences = differences.filter(ele => ele && RoomImportantFields.some(key => key === ele.key))
|
|
@@ -778,6 +778,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
778
778
|
default:
|
|
779
779
|
throw new Error('unknown payload type: ' + payloadType)
|
|
780
780
|
}
|
|
781
|
+
this.emit('dirty', payloadId, payloadType)
|
|
781
782
|
} catch (e) {
|
|
782
783
|
this.emit('error', GError.from(e))
|
|
783
784
|
}
|