@juzi/wechaty 1.0.71 → 1.0.73
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 +4 -4
- package/dist/cjs/src/user-modules/chat-history.d.ts +39 -0
- package/dist/cjs/src/user-modules/chat-history.d.ts.map +1 -0
- package/dist/cjs/src/user-modules/chat-history.js +91 -0
- package/dist/cjs/src/user-modules/chat-history.js.map +1 -0
- package/dist/cjs/src/user-modules/contact.d.ts +2 -1
- package/dist/cjs/src/user-modules/contact.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/contact.js +35 -0
- package/dist/cjs/src/user-modules/contact.js.map +1 -1
- package/dist/cjs/src/user-modules/message.d.ts +2 -0
- package/dist/cjs/src/user-modules/message.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/message.js +13 -4
- package/dist/cjs/src/user-modules/message.js.map +1 -1
- package/dist/cjs/src/user-modules/mod.d.ts +4 -3
- package/dist/cjs/src/user-modules/mod.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/mod.js +3 -1
- package/dist/cjs/src/user-modules/mod.js.map +1 -1
- package/dist/cjs/src/user-modules/room.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/room.js +5 -9
- package/dist/cjs/src/user-modules/room.js.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-base.d.ts +10 -115
- package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-impl.spec.js +3 -1
- package/dist/cjs/src/wechaty/wechaty-impl.spec.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +6 -12
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +6 -0
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +8 -0
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +4 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +4 -2
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +3 -0
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/dist/esm/src/package-json.js +4 -4
- package/dist/esm/src/user-modules/chat-history.d.ts +39 -0
- package/dist/esm/src/user-modules/chat-history.d.ts.map +1 -0
- package/dist/esm/src/user-modules/chat-history.js +65 -0
- package/dist/esm/src/user-modules/chat-history.js.map +1 -0
- package/dist/esm/src/user-modules/contact.d.ts +2 -1
- package/dist/esm/src/user-modules/contact.d.ts.map +1 -1
- package/dist/esm/src/user-modules/contact.js +35 -0
- package/dist/esm/src/user-modules/contact.js.map +1 -1
- package/dist/esm/src/user-modules/message.d.ts +2 -0
- package/dist/esm/src/user-modules/message.d.ts.map +1 -1
- package/dist/esm/src/user-modules/message.js +13 -4
- package/dist/esm/src/user-modules/message.js.map +1 -1
- package/dist/esm/src/user-modules/mod.d.ts +4 -3
- package/dist/esm/src/user-modules/mod.d.ts.map +1 -1
- package/dist/esm/src/user-modules/mod.js +2 -1
- package/dist/esm/src/user-modules/mod.js.map +1 -1
- package/dist/esm/src/user-modules/room.d.ts.map +1 -1
- package/dist/esm/src/user-modules/room.js +5 -9
- package/dist/esm/src/user-modules/room.js.map +1 -1
- package/dist/esm/src/wechaty/wechaty-base.d.ts +10 -115
- package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/esm/src/wechaty/wechaty-impl.spec.js +3 -1
- package/dist/esm/src/wechaty/wechaty-impl.spec.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +6 -12
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +6 -0
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +8 -0
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +4 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +4 -2
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/package.json +3 -3
- package/src/package-json.ts +4 -4
- package/src/user-modules/chat-history.ts +99 -0
- package/src/user-modules/contact.ts +41 -1
- package/src/user-modules/message.ts +18 -6
- package/src/user-modules/mod.ts +8 -0
- package/src/user-modules/room.ts +4 -15
- package/src/wechaty/wechaty-impl.spec.ts +3 -0
- package/src/wechaty-mixins/wechatify-user-module-mixin.ts +7 -1
|
@@ -105,6 +105,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
105
105
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
106
106
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
107
107
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
108
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
108
109
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
109
110
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
110
111
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -122,6 +123,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
122
123
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
123
124
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
124
125
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
126
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
125
127
|
wrapAsync: import("gerror/dist/esm/src/wrap-async-error/wrap-async-error.js").WrapAsync;
|
|
126
128
|
emitError(e: any): void;
|
|
127
129
|
__io?: import("../io.js").Io | undefined;
|
|
@@ -157,6 +159,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
157
159
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
158
160
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
159
161
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
162
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
160
163
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
161
164
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
162
165
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -174,6 +177,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
174
177
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
175
178
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
176
179
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
180
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
177
181
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
178
182
|
readonly id: string;
|
|
179
183
|
__memory?: import("memory-card").MemoryCard | undefined;
|
|
@@ -220,6 +224,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
220
224
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
221
225
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
222
226
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
227
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
223
228
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
224
229
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
225
230
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -237,6 +242,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
237
242
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
238
243
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
239
244
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
245
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
240
246
|
init(): Promise<void>;
|
|
241
247
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
242
248
|
readonly id: string;
|
|
@@ -390,6 +396,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
390
396
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
391
397
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
392
398
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
399
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
393
400
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
394
401
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
395
402
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -407,6 +414,7 @@ declare const pluginMixin: <MixinBase extends typeof WechatySkeleton & ((abstrac
|
|
|
407
414
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
408
415
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
409
416
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
417
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
410
418
|
__io?: import("../io.js").Io | undefined;
|
|
411
419
|
readonly io: import("../io.js").Io;
|
|
412
420
|
__ioToken?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/plugin-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACzB,MAAkC,cAAc,CAAA;AAKjD,OAAO,KAAK,EACV,eAAe,EAChB,MAA4B,mBAAmB,CAAA;AAKhD,UAAU,QAAQ;IAChB,GAAG,CACD,GAAG,OAAO,EAAE,CACR,aAAa,GACb,aAAa,EAAE,CAClB,EAAE,GACF,wBAAwB,CAAA;CAC5B;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASb;;;;;;;;;;;;;;;;;;OAkBG
|
|
1
|
+
{"version":3,"file":"plugin-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/plugin-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACzB,MAAkC,cAAc,CAAA;AAKjD,OAAO,KAAK,EACV,eAAe,EAChB,MAA4B,mBAAmB,CAAA;AAKhD,UAAU,QAAQ;IAChB,GAAG,CACD,GAAG,OAAO,EAAE,CACR,aAAa,GACb,aAAa,EAAE,CAClB,EAAE,GACF,wBAAwB,CAAA;CAC5B;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASb;;;;;;;;;;;;;;;;;;OAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAtBmB,GAAG,EAAE;IAI3B;;;;;;;;;;;;;;;;;;OAkBG;oBAEW,CACV,aAAa,GAAG,aAAa,EAAE,CAChC,EAAE,GACF,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAvB3B;;;;;;;;;;;;;;;;;;OAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkCN,CAAA;AAED,aAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAEjD,aAAK,4BAA4B,GAAG,KAAK,CAAA;AAEzC,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,WAAW,GACZ,CAAA"}
|
|
@@ -26,6 +26,7 @@ declare const puppetMixin: <MixinBase extends ((abstract new (...args: any[]) =>
|
|
|
26
26
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
27
27
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
28
28
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
29
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
29
30
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
30
31
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
31
32
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -43,6 +44,7 @@ declare const puppetMixin: <MixinBase extends ((abstract new (...args: any[]) =>
|
|
|
43
44
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
44
45
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
45
46
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
47
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
46
48
|
init(): Promise<void>;
|
|
47
49
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
48
50
|
readonly id: string;
|
|
@@ -158,6 +160,7 @@ declare const puppetMixin: <MixinBase extends ((abstract new (...args: any[]) =>
|
|
|
158
160
|
__wechatifiedChannel?: import("../user-modules/channel.js").ChannelConstructor | undefined;
|
|
159
161
|
__wechatifiedMoment?: import("../user-modules/moment.js").MomentConstructor | undefined;
|
|
160
162
|
__wechatifiedCallRecord?: import("../user-modules/call.js").CallRecordConstructor | undefined;
|
|
163
|
+
__wechatifiedChatHistory?: import("../user-modules/chat-history.js").ChatHistoryConstructor | undefined;
|
|
161
164
|
readonly Contact: import("../user-modules/contact.js").ContactConstructor;
|
|
162
165
|
readonly ContactSelf: import("../user-modules/contact-self.js").ContactSelfConstructor;
|
|
163
166
|
readonly Delay: import("../user-modules/delay.js").DelayConstructor;
|
|
@@ -175,6 +178,7 @@ declare const puppetMixin: <MixinBase extends ((abstract new (...args: any[]) =>
|
|
|
175
178
|
readonly Channel: import("../user-modules/channel.js").ChannelConstructor;
|
|
176
179
|
readonly Moment: import("../user-modules/moment.js").MomentConstructor;
|
|
177
180
|
readonly CallRecord: import("../user-modules/call.js").CallRecordConstructor;
|
|
181
|
+
readonly ChatHistory: import("../user-modules/chat-history.js").ChatHistoryConstructor;
|
|
178
182
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
179
183
|
readonly id: string;
|
|
180
184
|
__memory?: import("memory-card").MemoryCard | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puppet-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/puppet-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAW,sBAAsB,CAAA;AAQnD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACrB,MAAO,cAAc,CAAA;AAuBtB;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"puppet-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/puppet-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAW,sBAAsB,CAAA;AAQnD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACrB,MAAO,cAAc,CAAA;AAuBtB;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAqBS,GAAG,EAAE;;;2BANH,oBAAoB;sBAE1B,gBAAgB;;aAmBT,QAAQ,IAAI,CAAC;YA+Cd,QAAQ,IAAI,CAAC;aAuBrB,QAAQ,IAAI,CAAC;YAML,QAAQ,IAAI,CAAC;gCA8CR,OAAO,KAAK,CAAC,eAAe,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwlBnE,CAAA;AAED,aAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAEjD,aAAK,4BAA4B,GAC7B,UAAU,GACV,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAA;AAEtB,YAAY,EACV,WAAW,EACX,4BAA4B,GAC7B,CAAA;AACD,OAAO,EACL,WAAW,GACZ,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContactConstructor, ContactSelfConstructor, DelayConstructor, FriendshipConstructor, ImageConstructor, LocationConstructor, MessageConstructor, MiniProgramConstructor, PostConstructor, RoomConstructor, RoomInvitationConstructor, TagConstructor, TagGroupConstructor, UrlLinkConstructor, ChannelConstructor, MomentConstructor, CallRecordConstructor } from '../user-modules/mod.js';
|
|
1
|
+
import { ContactConstructor, ContactSelfConstructor, DelayConstructor, FriendshipConstructor, ImageConstructor, LocationConstructor, MessageConstructor, MiniProgramConstructor, PostConstructor, RoomConstructor, RoomInvitationConstructor, TagConstructor, TagGroupConstructor, UrlLinkConstructor, ChannelConstructor, MomentConstructor, CallRecordConstructor, ChatHistoryConstructor } from '../user-modules/mod.js';
|
|
2
2
|
import type { WechatySkeleton } from '../wechaty/mod.js';
|
|
3
3
|
declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleton>(mixinBase: MixinBase) => ((abstract new (...args: any[]) => {
|
|
4
4
|
__wechatifiedContact?: ContactConstructor | undefined;
|
|
@@ -18,6 +18,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
|
|
|
18
18
|
__wechatifiedChannel?: ChannelConstructor | undefined;
|
|
19
19
|
__wechatifiedMoment?: MomentConstructor | undefined;
|
|
20
20
|
__wechatifiedCallRecord?: CallRecordConstructor | undefined;
|
|
21
|
+
__wechatifiedChatHistory?: ChatHistoryConstructor | undefined;
|
|
21
22
|
readonly Contact: ContactConstructor;
|
|
22
23
|
readonly ContactSelf: ContactSelfConstructor;
|
|
23
24
|
readonly Delay: DelayConstructor;
|
|
@@ -35,6 +36,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
|
|
|
35
36
|
readonly Channel: ChannelConstructor;
|
|
36
37
|
readonly Moment: MomentConstructor;
|
|
37
38
|
readonly CallRecord: CallRecordConstructor;
|
|
39
|
+
readonly ChatHistory: ChatHistoryConstructor;
|
|
38
40
|
init(): Promise<void>;
|
|
39
41
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
40
42
|
readonly id: string;
|
|
@@ -63,7 +65,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
|
|
|
63
65
|
readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
|
|
64
66
|
}) & MixinBase;
|
|
65
67
|
declare type WechatifyUserModuleMixin = ReturnType<typeof wechatifyUserModuleMixin>;
|
|
66
|
-
declare type ProtectedPropertyWechatifyUserModuleMixin = '__wechatifiedContact' | '__wechatifiedContactSelf' | '__wechatifiedDelay' | '__wechatifiedFriendship' | '__wechatifiedImage' | '__wechatifiedLocation' | '__wechatifiedMessage' | '__wechatifiedMiniProgram' | '__wechatifiedRoom' | '__wechatifiedRoomInvitation' | '__wechatifiedTag' | '__wechatifiedTagGroup' | '__wechatifiedUrlLink' | '__wechatifiedChannel' | '__wechatifiedMoment' | '__wechatifiedCallRecord';
|
|
68
|
+
declare type ProtectedPropertyWechatifyUserModuleMixin = '__wechatifiedContact' | '__wechatifiedContactSelf' | '__wechatifiedDelay' | '__wechatifiedFriendship' | '__wechatifiedImage' | '__wechatifiedLocation' | '__wechatifiedMessage' | '__wechatifiedMiniProgram' | '__wechatifiedRoom' | '__wechatifiedRoomInvitation' | '__wechatifiedTag' | '__wechatifiedTagGroup' | '__wechatifiedUrlLink' | '__wechatifiedChannel' | '__wechatifiedMoment' | '__wechatifiedCallRecord' | '__wechatifiedChatHistory';
|
|
67
69
|
export type { WechatifyUserModuleMixin, ProtectedPropertyWechatifyUserModuleMixin, };
|
|
68
70
|
export { wechatifyUserModuleMixin, };
|
|
69
71
|
//# sourceMappingURL=wechatify-user-module-mixin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wechatify-user-module-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"wechatify-user-module-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,EAoBL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EAGvB,MAA4B,wBAAwB,CAAA;AAErD,OAAO,KAAK,EACV,eAAe,EAChB,MAAkC,mBAAmB,CAAA;AAEtD,QAAA,MAAM,wBAAwB,+FAKJ,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2CH,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;cA6CxC,CAAA;AAYD,aAAK,wBAAwB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE3E,aAAK,yCAAyC,GAC1C,sBAAsB,GACtB,0BAA0B,GAC1B,oBAAoB,GACpB,yBAAyB,GACzB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,0BAA0B,GAC1B,mBAAmB,GACnB,6BAA6B,GAC7B,kBAAkB,GAClB,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,yBAAyB,GACzB,0BAA0B,CAAA;AAE9B,YAAY,EACV,wBAAwB,EACxB,yCAAyC,GAC1C,CAAA;AACD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '@juzi/wechaty-puppet';
|
|
2
|
-
import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, TagGroupImpl, UrlLinkImpl, ChannelImpl, MomentImpl, CallRecordImpl, wechatifyUserModule, } from '../user-modules/mod.js';
|
|
2
|
+
import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, TagGroupImpl, UrlLinkImpl, ChannelImpl, MomentImpl, CallRecordImpl, ChatHistoryImpl, wechatifyUserModule, } from '../user-modules/mod.js';
|
|
3
3
|
const wechatifyUserModuleMixin = (mixinBase) => {
|
|
4
4
|
log.verbose('WechatifyUserModuleMixin', 'wechatifyUserModuleMixin(%s)', mixinBase.name);
|
|
5
5
|
class WechatifyUserModuleMixin extends mixinBase {
|
|
@@ -24,6 +24,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
24
24
|
__wechatifiedChannel;
|
|
25
25
|
__wechatifiedMoment;
|
|
26
26
|
__wechatifiedCallRecord;
|
|
27
|
+
__wechatifiedChatHistory;
|
|
27
28
|
get Contact() { return guardWechatify(this.__wechatifiedContact); }
|
|
28
29
|
get ContactSelf() { return guardWechatify(this.__wechatifiedContactSelf); }
|
|
29
30
|
get Delay() { return guardWechatify(this.__wechatifiedDelay); }
|
|
@@ -41,6 +42,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
41
42
|
get Channel() { return guardWechatify(this.__wechatifiedChannel); }
|
|
42
43
|
get Moment() { return guardWechatify(this.__wechatifiedMoment); }
|
|
43
44
|
get CallRecord() { return guardWechatify(this.__wechatifiedCallRecord); }
|
|
45
|
+
get ChatHistory() { return guardWechatify(this.__wechatifiedChatHistory); }
|
|
44
46
|
async init() {
|
|
45
47
|
log.verbose('WechatifyUserModuleMixin', 'init()');
|
|
46
48
|
await super.init();
|
|
@@ -75,6 +77,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
75
77
|
this.__wechatifiedChannel = wechatifyUserModule(ChannelImpl)(this);
|
|
76
78
|
this.__wechatifiedMoment = wechatifyUserModule(MomentImpl)(this);
|
|
77
79
|
this.__wechatifiedCallRecord = wechatifyUserModule(CallRecordImpl)(this);
|
|
80
|
+
this.__wechatifiedChatHistory = wechatifyUserModule(ChatHistoryImpl)(this);
|
|
78
81
|
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done');
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAe,sBAAsB,CAAA;AAEnD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,
|
|
1
|
+
{"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAe,sBAAsB,CAAA;AAEnD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,eAAe,EAqBf,mBAAmB,GACpB,MAA4B,wBAAwB,CAAA;AAMrD,MAAM,wBAAwB,GAAG,CAA4C,SAAoB,EAAE,EAAE;IACnG,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,8BA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AmB,CAAC,WAAW,CAAC,CAAC,IAAW,CAAC,CAAA;YAChF,IAAI,CAAC,oBAAoB,GAAU,mBAAmB,CAAC,WAAW,CAAC,CAAC,IAAW,CAAC,CAAA;YAChF,IAAI,CAAC,mBAAmB,GAAW,mBAAmB,CAAC,UAAU,CAAC,CAAC,IAAW,CAAC,CAAA;YAC/E,IAAI,CAAC,uBAAuB,GAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC,IAAW,CAAC,CAAA;YACnF,IAAI,CAAC,wBAAwB,GAAM,mBAAmB,CAAC,eAAe,CAAC,CAAC,IAAW,CAAC,CAAA;YAEpF,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,wDAAwD,CAAC,CAAA;QACnG,CAAC;KAEF;IAED,OAAO,wBAAwB,CAAA;AACjC,CAAC,CAAA;AAED;;GAEG;AACH,SAAS,cAAc,CAAsB,UAAc;IACzD,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAA;KAClB;IACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAA;AACjH,CAAC;AA2BD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juzi/wechaty",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.73",
|
|
4
4
|
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
"homepage": "https://github.com/wechaty/",
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"@juzi/wechaty-puppet-service": "^1.0.
|
|
112
|
+
"@juzi/wechaty-puppet-service": "^1.0.75",
|
|
113
113
|
"clone-class": "^1.1.1",
|
|
114
114
|
"cmd-ts": "^0.10.0",
|
|
115
115
|
"cockatiel": "^2.0.2",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"@chatie/eslint-config": "^1.0.4",
|
|
133
133
|
"@chatie/semver": "^0.4.7",
|
|
134
134
|
"@chatie/tsconfig": "^4.6.3",
|
|
135
|
-
"@juzi/wechaty-puppet": "^1.0.
|
|
135
|
+
"@juzi/wechaty-puppet": "^1.0.66",
|
|
136
136
|
"@juzi/wechaty-puppet-mock": "^1.0.1",
|
|
137
137
|
"@swc/core": "1.3.44",
|
|
138
138
|
"@swc/helpers": "^0.3.6",
|
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 = 'f845a2616af42a3a8bec582520c0a0042f00b18e'
|
|
8
8
|
export const packageJson: PackageJsonWechaty = {
|
|
9
9
|
"name": "@juzi/wechaty",
|
|
10
|
-
"version": "1.0.
|
|
10
|
+
"version": "1.0.73",
|
|
11
11
|
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
@@ -116,7 +116,7 @@ export const packageJson: PackageJsonWechaty = {
|
|
|
116
116
|
},
|
|
117
117
|
"homepage": "https://github.com/wechaty/",
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@juzi/wechaty-puppet-service": "^1.0.
|
|
119
|
+
"@juzi/wechaty-puppet-service": "^1.0.75",
|
|
120
120
|
"clone-class": "^1.1.1",
|
|
121
121
|
"cmd-ts": "^0.10.0",
|
|
122
122
|
"cockatiel": "^2.0.2",
|
|
@@ -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.66",
|
|
143
143
|
"@juzi/wechaty-puppet-mock": "^1.0.1",
|
|
144
144
|
"@swc/core": "1.3.44",
|
|
145
145
|
"@swc/helpers": "^0.3.6",
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as PUPPET from '@juzi/wechaty-puppet'
|
|
2
|
+
|
|
3
|
+
import type { Constructor } from 'clone-class'
|
|
4
|
+
import { log } from '../config.js'
|
|
5
|
+
|
|
6
|
+
import { validationMixin } from '../user-mixins/validation.js'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
wechatifyMixinBase,
|
|
10
|
+
} from '../user-mixins/wechatify.js'
|
|
11
|
+
import type { FileBoxInterface } from 'file-box'
|
|
12
|
+
import type { ChannelInterface } from './channel.js'
|
|
13
|
+
import type { ContactInterface } from './contact.js'
|
|
14
|
+
import type { LocationInterface } from './location.js'
|
|
15
|
+
import type { MiniProgramInterface } from './mini-program.js'
|
|
16
|
+
import type { UrlLinkInterface } from './url-link.js'
|
|
17
|
+
import { timestampToDate } from '../pure-functions/timestamp-to-date.js'
|
|
18
|
+
|
|
19
|
+
type ChatHistoryMessageType = string | ContactInterface | LocationInterface | MiniProgramInterface | UrlLinkInterface | ChannelInterface | ChatHistoryInterface | FileBoxInterface
|
|
20
|
+
|
|
21
|
+
class ChatHistoryMixin extends wechatifyMixinBase() {
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* @hideconstructor
|
|
25
|
+
*/
|
|
26
|
+
constructor (
|
|
27
|
+
public readonly payload: PUPPET.payloads.ChatHistory,
|
|
28
|
+
) {
|
|
29
|
+
super()
|
|
30
|
+
log.verbose('ChatHistory', 'constructor()')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
avatar (): FileBoxInterface {
|
|
34
|
+
return this.payload.avatar
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
name (): undefined | string {
|
|
38
|
+
const senderName = this.payload.senderName
|
|
39
|
+
const corpName = this.payload.corpName
|
|
40
|
+
if (corpName) {
|
|
41
|
+
return `${senderName}@${corpName}`
|
|
42
|
+
}
|
|
43
|
+
return senderName
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
date (): Date {
|
|
47
|
+
const time = this.payload.time
|
|
48
|
+
return timestampToDate(Number(time)) // FIXME: change the type from string to number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async message (): Promise<ChatHistoryMessageType> {
|
|
52
|
+
const type = this.type()
|
|
53
|
+
const message = this.payload.message
|
|
54
|
+
switch (type) {
|
|
55
|
+
case PUPPET.types.Message.Text:
|
|
56
|
+
case PUPPET.types.Message.Contact:
|
|
57
|
+
return message as string
|
|
58
|
+
case PUPPET.types.Message.Attachment:
|
|
59
|
+
case PUPPET.types.Message.Audio:
|
|
60
|
+
case PUPPET.types.Message.Emoticon:
|
|
61
|
+
case PUPPET.types.Message.Image:
|
|
62
|
+
case PUPPET.types.Message.Video:
|
|
63
|
+
return message as FileBoxInterface
|
|
64
|
+
case PUPPET.types.Message.Url:
|
|
65
|
+
return new this.wechaty.UrlLink(message)
|
|
66
|
+
case PUPPET.types.Message.Location:
|
|
67
|
+
return new this.wechaty.Location(message)
|
|
68
|
+
case PUPPET.types.Message.MiniProgram:
|
|
69
|
+
return new this.wechaty.MiniProgram(message)
|
|
70
|
+
case PUPPET.types.Message.Channel:
|
|
71
|
+
return new this.wechaty.Channel(message)
|
|
72
|
+
case PUPPET.types.Message.ChatHistory:
|
|
73
|
+
return new this.wechaty.ChatHistory(message)
|
|
74
|
+
default:
|
|
75
|
+
throw new Error(`Unsupported message type of chat history: ${PUPPET.types.Message[type]}`)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type (): PUPPET.types.Message {
|
|
80
|
+
return this.payload.type
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class ChatHistoryImpl extends validationMixin(ChatHistoryMixin)<ChatHistoryInterface>() { }
|
|
86
|
+
interface ChatHistoryInterface extends ChatHistoryImpl { }
|
|
87
|
+
|
|
88
|
+
type ChatHistoryConstructor = Constructor<
|
|
89
|
+
ChatHistoryInterface,
|
|
90
|
+
typeof ChatHistoryImpl
|
|
91
|
+
>
|
|
92
|
+
|
|
93
|
+
export type {
|
|
94
|
+
ChatHistoryConstructor,
|
|
95
|
+
ChatHistoryInterface,
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
ChatHistoryImpl,
|
|
99
|
+
}
|
|
@@ -215,6 +215,46 @@ class ContactMixin extends MixinBase implements SayableSayer {
|
|
|
215
215
|
return contactList
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
static async batchLoadContacts (contactIdList: string[]) {
|
|
219
|
+
let continuousErrorCount = 0
|
|
220
|
+
let totalErrorCount = 0
|
|
221
|
+
const totalErrorThreshold = Math.round(contactIdList.length / 5)
|
|
222
|
+
|
|
223
|
+
const idToContact = async (id: string) => {
|
|
224
|
+
if (!this.wechaty.isLoggedIn) {
|
|
225
|
+
throw new Error('wechaty not logged in')
|
|
226
|
+
}
|
|
227
|
+
const result = await this.wechaty.Contact.find({ id }).catch(e => {
|
|
228
|
+
this.wechaty.emitError(e)
|
|
229
|
+
continuousErrorCount++
|
|
230
|
+
totalErrorCount++
|
|
231
|
+
if (continuousErrorCount > 5) {
|
|
232
|
+
throw new Error('5 continuous errors!')
|
|
233
|
+
}
|
|
234
|
+
if (totalErrorCount > totalErrorThreshold) {
|
|
235
|
+
throw new Error(`${totalErrorThreshold} total errors!`)
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
continuousErrorCount = 0
|
|
239
|
+
return result
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* we need to use concurrencyExecuter to reduce the parallel number of the requests
|
|
244
|
+
*/
|
|
245
|
+
const CONCURRENCY = 17
|
|
246
|
+
const contactIterator = concurrencyExecuter(CONCURRENCY)(idToContact)(contactIdList)
|
|
247
|
+
|
|
248
|
+
const contactList: ContactInterface[] = []
|
|
249
|
+
|
|
250
|
+
for await (const contact of contactIterator) {
|
|
251
|
+
if (contact) {
|
|
252
|
+
contactList.push(contact)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return contactList
|
|
256
|
+
}
|
|
257
|
+
|
|
218
258
|
// TODO
|
|
219
259
|
// eslint-disable-next-line no-use-before-define
|
|
220
260
|
static async delete (contact: ContactInterface): Promise<void> {
|
|
@@ -855,7 +895,7 @@ class ContactImpl extends validationMixin(ContactImplBase)<ContactInterface>() {
|
|
|
855
895
|
|
|
856
896
|
type ContactConstructor = Constructor<
|
|
857
897
|
ContactImplInterface,
|
|
858
|
-
Omit<typeof ContactImpl, 'load'>
|
|
898
|
+
Omit<typeof ContactImpl, 'load' | 'batchLoadContacts'>
|
|
859
899
|
>
|
|
860
900
|
|
|
861
901
|
export type {
|
|
@@ -76,6 +76,7 @@ import { validationMixin } from '../user-mixins/validation.js'
|
|
|
76
76
|
import type { ContactSelfImpl } from './contact-self.js'
|
|
77
77
|
import { concurrencyExecuter } from 'rx-queue'
|
|
78
78
|
import type { CallRecordInterface } from './call.js'
|
|
79
|
+
import type { ChatHistoryInterface } from './chat-history.js'
|
|
79
80
|
|
|
80
81
|
const MixinBase = wechatifyMixin(
|
|
81
82
|
EventEmitter,
|
|
@@ -872,13 +873,9 @@ class MessageMixin extends MixinBase implements SayableSayer {
|
|
|
872
873
|
&& 'mentionIdList' in this.payload
|
|
873
874
|
&& Array.isArray(this.payload.mentionIdList)
|
|
874
875
|
) {
|
|
875
|
-
const
|
|
876
|
-
const allContact = await Promise.all(
|
|
877
|
-
this.payload.mentionIdList
|
|
878
|
-
.map(idToContact),
|
|
879
|
-
)
|
|
876
|
+
const contactList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(this.payload.mentionIdList)
|
|
880
877
|
// remove `undefined` types because we use a `filter(Boolean)`
|
|
881
|
-
return
|
|
878
|
+
return contactList
|
|
882
879
|
}
|
|
883
880
|
|
|
884
881
|
/**
|
|
@@ -1345,6 +1342,21 @@ class MessageMixin extends MixinBase implements SayableSayer {
|
|
|
1345
1342
|
return new this.wechaty.CallRecord(callRecordPayload)
|
|
1346
1343
|
}
|
|
1347
1344
|
|
|
1345
|
+
public async toChatHistory (): Promise<ChatHistoryInterface> {
|
|
1346
|
+
log.verbose('Message', 'toChatHistory()')
|
|
1347
|
+
|
|
1348
|
+
if (!this.payload) {
|
|
1349
|
+
throw new Error('no payload')
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
if (this.type() !== PUPPET.types.Message.ChatHistory) {
|
|
1353
|
+
throw new Error('message not a ChatHistory')
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
const chatHistoryPayload = await this.wechaty.puppet.messageChatHistory(this.id)
|
|
1357
|
+
return new this.wechaty.ChatHistory(chatHistoryPayload)
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1348
1360
|
async toSayable (): Promise<undefined | Sayable> {
|
|
1349
1361
|
log.verbose('Message', 'toSayable()')
|
|
1350
1362
|
return messageToSayable(this)
|
package/src/user-modules/mod.ts
CHANGED
|
@@ -112,6 +112,11 @@ import {
|
|
|
112
112
|
CallRecordInterface,
|
|
113
113
|
CallRecordConstructor,
|
|
114
114
|
} from './call.js'
|
|
115
|
+
import {
|
|
116
|
+
ChatHistoryImpl,
|
|
117
|
+
ChatHistoryInterface,
|
|
118
|
+
ChatHistoryConstructor,
|
|
119
|
+
} from './chat-history.js'
|
|
115
120
|
|
|
116
121
|
import { wechatifyUserModule } from '../user-mixins/wechatify.js'
|
|
117
122
|
|
|
@@ -135,6 +140,7 @@ export type {
|
|
|
135
140
|
UrlLinkInterface,
|
|
136
141
|
ChannelInterface,
|
|
137
142
|
CallRecordInterface,
|
|
143
|
+
ChatHistoryInterface,
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
export type {
|
|
@@ -157,6 +163,7 @@ export type {
|
|
|
157
163
|
UrlLinkConstructor,
|
|
158
164
|
ChannelConstructor,
|
|
159
165
|
CallRecordConstructor,
|
|
166
|
+
ChatHistoryConstructor,
|
|
160
167
|
}
|
|
161
168
|
|
|
162
169
|
export {
|
|
@@ -181,4 +188,5 @@ export {
|
|
|
181
188
|
UrlLinkImpl,
|
|
182
189
|
ChannelImpl,
|
|
183
190
|
CallRecordImpl,
|
|
191
|
+
ChatHistoryImpl,
|
|
184
192
|
}
|
package/src/user-modules/room.ts
CHANGED
|
@@ -837,12 +837,9 @@ class RoomMixin extends MixinBase implements SayableSayer {
|
|
|
837
837
|
return this.payload.topic
|
|
838
838
|
} else {
|
|
839
839
|
const memberIdList = await this.wechaty.puppet.roomMemberList(this.id)
|
|
840
|
-
const
|
|
840
|
+
const memberIdListWithoutBot = memberIdList
|
|
841
841
|
.filter(id => id !== this.wechaty.puppet.currentUserId)
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
const memberList = (await Promise.all(memberListFuture))
|
|
845
|
-
.filter(Boolean) as ContactInterface[]
|
|
842
|
+
const memberList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(memberIdListWithoutBot)
|
|
846
843
|
|
|
847
844
|
let defaultTopic = (memberList[0] && memberList[0].name()) || ''
|
|
848
845
|
for (let i = 1; i < 3 && memberList[i]; i++) {
|
|
@@ -1069,11 +1066,8 @@ class RoomMixin extends MixinBase implements SayableSayer {
|
|
|
1069
1066
|
}
|
|
1070
1067
|
|
|
1071
1068
|
const contactIdList = await this.wechaty.puppet.roomMemberSearch(this.id, query)
|
|
1072
|
-
const
|
|
1073
|
-
contactIdList.map(id => this.wechaty.Contact.find({ id })),
|
|
1074
|
-
)
|
|
1069
|
+
const contactList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(contactIdList)
|
|
1075
1070
|
|
|
1076
|
-
const contactList = contactListAll.filter(c => !!c) as ContactInterface[]
|
|
1077
1071
|
return contactList
|
|
1078
1072
|
}
|
|
1079
1073
|
|
|
@@ -1153,13 +1147,8 @@ class RoomMixin extends MixinBase implements SayableSayer {
|
|
|
1153
1147
|
// return []
|
|
1154
1148
|
// }
|
|
1155
1149
|
|
|
1156
|
-
const
|
|
1157
|
-
memberIdList.map(
|
|
1158
|
-
id => this.wechaty.Contact.find({ id }),
|
|
1159
|
-
),
|
|
1160
|
-
)
|
|
1150
|
+
const contactList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(memberIdList)
|
|
1161
1151
|
|
|
1162
|
-
const contactList = contactListAll.filter(c => !!c) as ContactInterface[]
|
|
1163
1152
|
return contactList
|
|
1164
1153
|
}
|
|
1165
1154
|
|
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
ChannelConstructor,
|
|
24
24
|
MomentConstructor,
|
|
25
25
|
CallRecordConstructor,
|
|
26
|
+
ChatHistoryConstructor,
|
|
26
27
|
} from '../user-modules/mod.js'
|
|
27
28
|
|
|
28
29
|
import {
|
|
@@ -53,6 +54,7 @@ test('Wechaty interface', async t => {
|
|
|
53
54
|
Channel : ChannelConstructor
|
|
54
55
|
Moment : MomentConstructor
|
|
55
56
|
CallRecord : CallRecordConstructor
|
|
57
|
+
ChatHistory : ChatHistoryConstructor
|
|
56
58
|
|
|
57
59
|
constructor () {
|
|
58
60
|
super()
|
|
@@ -74,6 +76,7 @@ test('Wechaty interface', async t => {
|
|
|
74
76
|
= this.Channel
|
|
75
77
|
= this.Moment
|
|
76
78
|
= this.CallRecord
|
|
79
|
+
= this.ChatHistory
|
|
77
80
|
= {} as any
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ChannelImpl,
|
|
19
19
|
MomentImpl,
|
|
20
20
|
CallRecordImpl,
|
|
21
|
+
ChatHistoryImpl,
|
|
21
22
|
|
|
22
23
|
ContactConstructor,
|
|
23
24
|
ContactSelfConstructor,
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
ChannelConstructor,
|
|
37
38
|
MomentConstructor,
|
|
38
39
|
CallRecordConstructor,
|
|
40
|
+
ChatHistoryConstructor,
|
|
39
41
|
|
|
40
42
|
wechatifyUserModule,
|
|
41
43
|
} from '../user-modules/mod.js'
|
|
@@ -71,6 +73,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
71
73
|
__wechatifiedChannel? : ChannelConstructor
|
|
72
74
|
__wechatifiedMoment? : MomentConstructor
|
|
73
75
|
__wechatifiedCallRecord? : CallRecordConstructor
|
|
76
|
+
__wechatifiedChatHistory? : ChatHistoryConstructor
|
|
74
77
|
|
|
75
78
|
get Contact () : ContactConstructor { return guardWechatify(this.__wechatifiedContact) }
|
|
76
79
|
get ContactSelf () : ContactSelfConstructor { return guardWechatify(this.__wechatifiedContactSelf) }
|
|
@@ -88,7 +91,8 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
88
91
|
get UrlLink () : UrlLinkConstructor { return guardWechatify(this.__wechatifiedUrlLink) }
|
|
89
92
|
get Channel () : ChannelConstructor { return guardWechatify(this.__wechatifiedChannel) }
|
|
90
93
|
get Moment () : MomentConstructor { return guardWechatify(this.__wechatifiedMoment) }
|
|
91
|
-
get CallRecord () : CallRecordConstructor { return guardWechatify(this.__wechatifiedCallRecord)
|
|
94
|
+
get CallRecord () : CallRecordConstructor { return guardWechatify(this.__wechatifiedCallRecord) }
|
|
95
|
+
get ChatHistory () : ChatHistoryConstructor { return guardWechatify(this.__wechatifiedChatHistory) }
|
|
92
96
|
|
|
93
97
|
override async init (): Promise<void> {
|
|
94
98
|
log.verbose('WechatifyUserModuleMixin', 'init()')
|
|
@@ -127,6 +131,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
127
131
|
this.__wechatifiedChannel = wechatifyUserModule(ChannelImpl)(this as any)
|
|
128
132
|
this.__wechatifiedMoment = wechatifyUserModule(MomentImpl)(this as any)
|
|
129
133
|
this.__wechatifiedCallRecord = wechatifyUserModule(CallRecordImpl)(this as any)
|
|
134
|
+
this.__wechatifiedChatHistory = wechatifyUserModule(ChatHistoryImpl)(this as any)
|
|
130
135
|
|
|
131
136
|
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done')
|
|
132
137
|
}
|
|
@@ -165,6 +170,7 @@ type ProtectedPropertyWechatifyUserModuleMixin =
|
|
|
165
170
|
| '__wechatifiedChannel'
|
|
166
171
|
| '__wechatifiedMoment'
|
|
167
172
|
| '__wechatifiedCallRecord'
|
|
173
|
+
| '__wechatifiedChatHistory'
|
|
168
174
|
|
|
169
175
|
export type {
|
|
170
176
|
WechatifyUserModuleMixin,
|