@juzi/wechaty 1.0.159 → 1.0.161

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.
Files changed (373) hide show
  1. package/dist/cjs/src/io.js +40 -40
  2. package/dist/cjs/src/io.js.map +1 -1
  3. package/dist/cjs/src/package-json.js +4 -4
  4. package/dist/cjs/src/schemas/logger.d.ts +2 -0
  5. package/dist/cjs/src/schemas/logger.d.ts.map +1 -0
  6. package/dist/cjs/src/schemas/logger.js +3 -0
  7. package/dist/cjs/src/schemas/logger.js.map +1 -0
  8. package/dist/cjs/src/schemas/mod.d.ts +2 -1
  9. package/dist/cjs/src/schemas/mod.d.ts.map +1 -1
  10. package/dist/cjs/src/schemas/mod.js.map +1 -1
  11. package/dist/cjs/src/schemas/wechaty-options.d.ts +19 -0
  12. package/dist/cjs/src/schemas/wechaty-options.d.ts.map +1 -1
  13. package/dist/cjs/src/user-mixins/wechatify.d.ts +23 -0
  14. package/dist/cjs/src/user-mixins/wechatify.d.ts.map +1 -1
  15. package/dist/cjs/src/user-mixins/wechatify.js +25 -0
  16. package/dist/cjs/src/user-mixins/wechatify.js.map +1 -1
  17. package/dist/cjs/src/user-modules/call.d.ts +4 -0
  18. package/dist/cjs/src/user-modules/call.d.ts.map +1 -1
  19. package/dist/cjs/src/user-modules/call.js +6 -7
  20. package/dist/cjs/src/user-modules/call.js.map +1 -1
  21. package/dist/cjs/src/user-modules/channel-card.d.ts +2 -0
  22. package/dist/cjs/src/user-modules/channel-card.d.ts.map +1 -1
  23. package/dist/cjs/src/user-modules/channel-card.js +2 -3
  24. package/dist/cjs/src/user-modules/channel-card.js.map +1 -1
  25. package/dist/cjs/src/user-modules/channel.d.ts +2 -0
  26. package/dist/cjs/src/user-modules/channel.d.ts.map +1 -1
  27. package/dist/cjs/src/user-modules/channel.js +2 -3
  28. package/dist/cjs/src/user-modules/channel.js.map +1 -1
  29. package/dist/cjs/src/user-modules/chat-history.d.ts +2 -0
  30. package/dist/cjs/src/user-modules/chat-history.d.ts.map +1 -1
  31. package/dist/cjs/src/user-modules/chat-history.js +2 -3
  32. package/dist/cjs/src/user-modules/chat-history.js.map +1 -1
  33. package/dist/cjs/src/user-modules/consult-card.d.ts +2 -0
  34. package/dist/cjs/src/user-modules/consult-card.d.ts.map +1 -1
  35. package/dist/cjs/src/user-modules/consult-card.js +3 -4
  36. package/dist/cjs/src/user-modules/consult-card.js.map +1 -1
  37. package/dist/cjs/src/user-modules/contact-self.d.ts.map +1 -1
  38. package/dist/cjs/src/user-modules/contact-self.js +8 -9
  39. package/dist/cjs/src/user-modules/contact-self.js.map +1 -1
  40. package/dist/cjs/src/user-modules/contact.d.ts +2 -0
  41. package/dist/cjs/src/user-modules/contact.d.ts.map +1 -1
  42. package/dist/cjs/src/user-modules/contact.js +36 -37
  43. package/dist/cjs/src/user-modules/contact.js.map +1 -1
  44. package/dist/cjs/src/user-modules/delay.d.ts +2 -0
  45. package/dist/cjs/src/user-modules/delay.d.ts.map +1 -1
  46. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
  47. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
  48. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js +2 -3
  49. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
  50. package/dist/cjs/src/user-modules/favorite.d.ts +21 -0
  51. package/dist/cjs/src/user-modules/favorite.d.ts.map +1 -1
  52. package/dist/cjs/src/user-modules/favorite.js +1 -21
  53. package/dist/cjs/src/user-modules/favorite.js.map +1 -1
  54. package/dist/cjs/src/user-modules/friendship.d.ts +2 -0
  55. package/dist/cjs/src/user-modules/friendship.d.ts.map +1 -1
  56. package/dist/cjs/src/user-modules/friendship.js +11 -12
  57. package/dist/cjs/src/user-modules/friendship.js.map +1 -1
  58. package/dist/cjs/src/user-modules/im-specific.d.ts +2 -0
  59. package/dist/cjs/src/user-modules/im-specific.d.ts.map +1 -1
  60. package/dist/cjs/src/user-modules/im-specific.js +1 -2
  61. package/dist/cjs/src/user-modules/im-specific.js.map +1 -1
  62. package/dist/cjs/src/user-modules/image.d.ts +22 -0
  63. package/dist/cjs/src/user-modules/image.d.ts.map +1 -1
  64. package/dist/cjs/src/user-modules/image.js +5 -6
  65. package/dist/cjs/src/user-modules/image.js.map +1 -1
  66. package/dist/cjs/src/user-modules/location.d.ts +2 -0
  67. package/dist/cjs/src/user-modules/location.d.ts.map +1 -1
  68. package/dist/cjs/src/user-modules/location.js +2 -3
  69. package/dist/cjs/src/user-modules/location.js.map +1 -1
  70. package/dist/cjs/src/user-modules/message.d.ts +2 -0
  71. package/dist/cjs/src/user-modules/message.d.ts.map +1 -1
  72. package/dist/cjs/src/user-modules/message.js +55 -55
  73. package/dist/cjs/src/user-modules/message.js.map +1 -1
  74. package/dist/cjs/src/user-modules/mini-program.d.ts +2 -0
  75. package/dist/cjs/src/user-modules/mini-program.d.ts.map +1 -1
  76. package/dist/cjs/src/user-modules/mini-program.js +2 -3
  77. package/dist/cjs/src/user-modules/mini-program.js.map +1 -1
  78. package/dist/cjs/src/user-modules/moment.d.ts +21 -0
  79. package/dist/cjs/src/user-modules/moment.d.ts.map +1 -1
  80. package/dist/cjs/src/user-modules/moment.js +5 -25
  81. package/dist/cjs/src/user-modules/moment.js.map +1 -1
  82. package/dist/cjs/src/user-modules/money.d.ts +2 -0
  83. package/dist/cjs/src/user-modules/money.d.ts.map +1 -1
  84. package/dist/cjs/src/user-modules/post.d.ts +2 -0
  85. package/dist/cjs/src/user-modules/post.d.ts.map +1 -1
  86. package/dist/cjs/src/user-modules/post.js +25 -25
  87. package/dist/cjs/src/user-modules/post.js.map +1 -1
  88. package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts +2 -0
  89. package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
  90. package/dist/cjs/src/user-modules/premium-online-appointment-card.js +2 -3
  91. package/dist/cjs/src/user-modules/premium-online-appointment-card.js.map +1 -1
  92. package/dist/cjs/src/user-modules/room-invitation.d.ts +2 -0
  93. package/dist/cjs/src/user-modules/room-invitation.d.ts.map +1 -1
  94. package/dist/cjs/src/user-modules/room-invitation.js +10 -11
  95. package/dist/cjs/src/user-modules/room-invitation.js.map +1 -1
  96. package/dist/cjs/src/user-modules/room.d.ts +2 -0
  97. package/dist/cjs/src/user-modules/room.d.ts.map +1 -1
  98. package/dist/cjs/src/user-modules/room.js +43 -43
  99. package/dist/cjs/src/user-modules/room.js.map +1 -1
  100. package/dist/cjs/src/user-modules/tag-group.d.ts +2 -0
  101. package/dist/cjs/src/user-modules/tag-group.d.ts.map +1 -1
  102. package/dist/cjs/src/user-modules/tag-group.js +13 -14
  103. package/dist/cjs/src/user-modules/tag-group.js.map +1 -1
  104. package/dist/cjs/src/user-modules/tag.d.ts +2 -0
  105. package/dist/cjs/src/user-modules/tag.d.ts.map +1 -1
  106. package/dist/cjs/src/user-modules/tag.js +21 -22
  107. package/dist/cjs/src/user-modules/tag.js.map +1 -1
  108. package/dist/cjs/src/user-modules/url-link.d.ts +2 -0
  109. package/dist/cjs/src/user-modules/url-link.d.ts.map +1 -1
  110. package/dist/cjs/src/user-modules/url-link.js +2 -3
  111. package/dist/cjs/src/user-modules/url-link.js.map +1 -1
  112. package/dist/cjs/src/user-modules/voice.d.ts +2 -0
  113. package/dist/cjs/src/user-modules/voice.d.ts.map +1 -1
  114. package/dist/cjs/src/user-modules/voice.js +8 -9
  115. package/dist/cjs/src/user-modules/voice.js.map +1 -1
  116. package/dist/cjs/src/user-modules/wecom.d.ts +3 -1
  117. package/dist/cjs/src/user-modules/wecom.d.ts.map +1 -1
  118. package/dist/cjs/src/user-modules/wecom.js +2 -3
  119. package/dist/cjs/src/user-modules/wecom.js.map +1 -1
  120. package/dist/cjs/src/user-modules/wxxd-order.d.ts +2 -0
  121. package/dist/cjs/src/user-modules/wxxd-order.d.ts.map +1 -1
  122. package/dist/cjs/src/user-modules/wxxd-order.js +9 -10
  123. package/dist/cjs/src/user-modules/wxxd-order.js.map +1 -1
  124. package/dist/cjs/src/user-modules/wxxd-product.d.ts +2 -0
  125. package/dist/cjs/src/user-modules/wxxd-product.d.ts.map +1 -1
  126. package/dist/cjs/src/user-modules/wxxd-product.js +6 -7
  127. package/dist/cjs/src/user-modules/wxxd-product.js.map +1 -1
  128. package/dist/cjs/src/wechaty/wechaty-base.d.ts +21 -37
  129. package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
  130. package/dist/cjs/src/wechaty/wechaty-base.js +17 -17
  131. package/dist/cjs/src/wechaty/wechaty-base.js.map +1 -1
  132. package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts +15 -4
  133. package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
  134. package/dist/cjs/src/wechaty/wechaty-skeleton.js +17 -6
  135. package/dist/cjs/src/wechaty/wechaty-skeleton.js.map +1 -1
  136. package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
  137. package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
  138. package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts +12 -6
  139. package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
  140. package/dist/cjs/src/wechaty-mixins/io-mixin.js +8 -8
  141. package/dist/cjs/src/wechaty-mixins/io-mixin.js.map +1 -1
  142. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +53 -19
  143. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  144. package/dist/cjs/src/wechaty-mixins/login-mixin.js +5 -5
  145. package/dist/cjs/src/wechaty-mixins/login-mixin.js.map +1 -1
  146. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +15 -10
  147. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  148. package/dist/cjs/src/wechaty-mixins/misc-mixin.js +1 -1
  149. package/dist/cjs/src/wechaty-mixins/misc-mixin.js.map +1 -1
  150. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
  151. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  152. package/dist/cjs/src/wechaty-mixins/plugin-mixin.js +5 -5
  153. package/dist/cjs/src/wechaty-mixins/plugin-mixin.js.map +1 -1
  154. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +16 -34
  155. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  156. package/dist/cjs/src/wechaty-mixins/puppet-mixin.js +90 -90
  157. package/dist/cjs/src/wechaty-mixins/puppet-mixin.js.map +1 -1
  158. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
  159. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  160. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
  161. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  162. package/dist/esm/src/io.js +40 -40
  163. package/dist/esm/src/io.js.map +1 -1
  164. package/dist/esm/src/package-json.js +4 -4
  165. package/dist/esm/src/schemas/logger.d.ts +2 -0
  166. package/dist/esm/src/schemas/logger.d.ts.map +1 -0
  167. package/dist/esm/src/schemas/logger.js +2 -0
  168. package/dist/esm/src/schemas/logger.js.map +1 -0
  169. package/dist/esm/src/schemas/mod.d.ts +2 -1
  170. package/dist/esm/src/schemas/mod.d.ts.map +1 -1
  171. package/dist/esm/src/schemas/mod.js.map +1 -1
  172. package/dist/esm/src/schemas/wechaty-options.d.ts +19 -0
  173. package/dist/esm/src/schemas/wechaty-options.d.ts.map +1 -1
  174. package/dist/esm/src/user-mixins/wechatify.d.ts +23 -0
  175. package/dist/esm/src/user-mixins/wechatify.d.ts.map +1 -1
  176. package/dist/esm/src/user-mixins/wechatify.js +25 -0
  177. package/dist/esm/src/user-mixins/wechatify.js.map +1 -1
  178. package/dist/esm/src/user-modules/call.d.ts +4 -0
  179. package/dist/esm/src/user-modules/call.d.ts.map +1 -1
  180. package/dist/esm/src/user-modules/call.js +6 -7
  181. package/dist/esm/src/user-modules/call.js.map +1 -1
  182. package/dist/esm/src/user-modules/channel-card.d.ts +2 -0
  183. package/dist/esm/src/user-modules/channel-card.d.ts.map +1 -1
  184. package/dist/esm/src/user-modules/channel-card.js +2 -3
  185. package/dist/esm/src/user-modules/channel-card.js.map +1 -1
  186. package/dist/esm/src/user-modules/channel.d.ts +2 -0
  187. package/dist/esm/src/user-modules/channel.d.ts.map +1 -1
  188. package/dist/esm/src/user-modules/channel.js +2 -3
  189. package/dist/esm/src/user-modules/channel.js.map +1 -1
  190. package/dist/esm/src/user-modules/chat-history.d.ts +2 -0
  191. package/dist/esm/src/user-modules/chat-history.d.ts.map +1 -1
  192. package/dist/esm/src/user-modules/chat-history.js +2 -3
  193. package/dist/esm/src/user-modules/chat-history.js.map +1 -1
  194. package/dist/esm/src/user-modules/consult-card.d.ts +2 -0
  195. package/dist/esm/src/user-modules/consult-card.d.ts.map +1 -1
  196. package/dist/esm/src/user-modules/consult-card.js +3 -4
  197. package/dist/esm/src/user-modules/consult-card.js.map +1 -1
  198. package/dist/esm/src/user-modules/contact-self.d.ts.map +1 -1
  199. package/dist/esm/src/user-modules/contact-self.js +8 -9
  200. package/dist/esm/src/user-modules/contact-self.js.map +1 -1
  201. package/dist/esm/src/user-modules/contact.d.ts +2 -0
  202. package/dist/esm/src/user-modules/contact.d.ts.map +1 -1
  203. package/dist/esm/src/user-modules/contact.js +36 -37
  204. package/dist/esm/src/user-modules/contact.js.map +1 -1
  205. package/dist/esm/src/user-modules/delay.d.ts +2 -0
  206. package/dist/esm/src/user-modules/delay.d.ts.map +1 -1
  207. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
  208. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
  209. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js +2 -3
  210. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
  211. package/dist/esm/src/user-modules/favorite.d.ts +21 -0
  212. package/dist/esm/src/user-modules/favorite.d.ts.map +1 -1
  213. package/dist/esm/src/user-modules/favorite.js +1 -21
  214. package/dist/esm/src/user-modules/favorite.js.map +1 -1
  215. package/dist/esm/src/user-modules/friendship.d.ts +2 -0
  216. package/dist/esm/src/user-modules/friendship.d.ts.map +1 -1
  217. package/dist/esm/src/user-modules/friendship.js +11 -12
  218. package/dist/esm/src/user-modules/friendship.js.map +1 -1
  219. package/dist/esm/src/user-modules/im-specific.d.ts +2 -0
  220. package/dist/esm/src/user-modules/im-specific.d.ts.map +1 -1
  221. package/dist/esm/src/user-modules/im-specific.js +1 -2
  222. package/dist/esm/src/user-modules/im-specific.js.map +1 -1
  223. package/dist/esm/src/user-modules/image.d.ts +22 -0
  224. package/dist/esm/src/user-modules/image.d.ts.map +1 -1
  225. package/dist/esm/src/user-modules/image.js +5 -6
  226. package/dist/esm/src/user-modules/image.js.map +1 -1
  227. package/dist/esm/src/user-modules/location.d.ts +2 -0
  228. package/dist/esm/src/user-modules/location.d.ts.map +1 -1
  229. package/dist/esm/src/user-modules/location.js +2 -3
  230. package/dist/esm/src/user-modules/location.js.map +1 -1
  231. package/dist/esm/src/user-modules/message.d.ts +2 -0
  232. package/dist/esm/src/user-modules/message.d.ts.map +1 -1
  233. package/dist/esm/src/user-modules/message.js +56 -56
  234. package/dist/esm/src/user-modules/message.js.map +1 -1
  235. package/dist/esm/src/user-modules/mini-program.d.ts +2 -0
  236. package/dist/esm/src/user-modules/mini-program.d.ts.map +1 -1
  237. package/dist/esm/src/user-modules/mini-program.js +2 -3
  238. package/dist/esm/src/user-modules/mini-program.js.map +1 -1
  239. package/dist/esm/src/user-modules/moment.d.ts +21 -0
  240. package/dist/esm/src/user-modules/moment.d.ts.map +1 -1
  241. package/dist/esm/src/user-modules/moment.js +5 -25
  242. package/dist/esm/src/user-modules/moment.js.map +1 -1
  243. package/dist/esm/src/user-modules/money.d.ts +2 -0
  244. package/dist/esm/src/user-modules/money.d.ts.map +1 -1
  245. package/dist/esm/src/user-modules/post.d.ts +2 -0
  246. package/dist/esm/src/user-modules/post.d.ts.map +1 -1
  247. package/dist/esm/src/user-modules/post.js +25 -25
  248. package/dist/esm/src/user-modules/post.js.map +1 -1
  249. package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts +2 -0
  250. package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
  251. package/dist/esm/src/user-modules/premium-online-appointment-card.js +2 -3
  252. package/dist/esm/src/user-modules/premium-online-appointment-card.js.map +1 -1
  253. package/dist/esm/src/user-modules/room-invitation.d.ts +2 -0
  254. package/dist/esm/src/user-modules/room-invitation.d.ts.map +1 -1
  255. package/dist/esm/src/user-modules/room-invitation.js +10 -11
  256. package/dist/esm/src/user-modules/room-invitation.js.map +1 -1
  257. package/dist/esm/src/user-modules/room.d.ts +2 -0
  258. package/dist/esm/src/user-modules/room.d.ts.map +1 -1
  259. package/dist/esm/src/user-modules/room.js +44 -44
  260. package/dist/esm/src/user-modules/room.js.map +1 -1
  261. package/dist/esm/src/user-modules/tag-group.d.ts +2 -0
  262. package/dist/esm/src/user-modules/tag-group.d.ts.map +1 -1
  263. package/dist/esm/src/user-modules/tag-group.js +13 -14
  264. package/dist/esm/src/user-modules/tag-group.js.map +1 -1
  265. package/dist/esm/src/user-modules/tag.d.ts +2 -0
  266. package/dist/esm/src/user-modules/tag.d.ts.map +1 -1
  267. package/dist/esm/src/user-modules/tag.js +21 -22
  268. package/dist/esm/src/user-modules/tag.js.map +1 -1
  269. package/dist/esm/src/user-modules/url-link.d.ts +2 -0
  270. package/dist/esm/src/user-modules/url-link.d.ts.map +1 -1
  271. package/dist/esm/src/user-modules/url-link.js +2 -3
  272. package/dist/esm/src/user-modules/url-link.js.map +1 -1
  273. package/dist/esm/src/user-modules/voice.d.ts +2 -0
  274. package/dist/esm/src/user-modules/voice.d.ts.map +1 -1
  275. package/dist/esm/src/user-modules/voice.js +8 -9
  276. package/dist/esm/src/user-modules/voice.js.map +1 -1
  277. package/dist/esm/src/user-modules/wecom.d.ts +3 -1
  278. package/dist/esm/src/user-modules/wecom.d.ts.map +1 -1
  279. package/dist/esm/src/user-modules/wecom.js +2 -3
  280. package/dist/esm/src/user-modules/wecom.js.map +1 -1
  281. package/dist/esm/src/user-modules/wxxd-order.d.ts +2 -0
  282. package/dist/esm/src/user-modules/wxxd-order.d.ts.map +1 -1
  283. package/dist/esm/src/user-modules/wxxd-order.js +9 -10
  284. package/dist/esm/src/user-modules/wxxd-order.js.map +1 -1
  285. package/dist/esm/src/user-modules/wxxd-product.d.ts +2 -0
  286. package/dist/esm/src/user-modules/wxxd-product.d.ts.map +1 -1
  287. package/dist/esm/src/user-modules/wxxd-product.js +6 -7
  288. package/dist/esm/src/user-modules/wxxd-product.js.map +1 -1
  289. package/dist/esm/src/wechaty/wechaty-base.d.ts +21 -37
  290. package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
  291. package/dist/esm/src/wechaty/wechaty-base.js +17 -17
  292. package/dist/esm/src/wechaty/wechaty-base.js.map +1 -1
  293. package/dist/esm/src/wechaty/wechaty-skeleton.d.ts +15 -4
  294. package/dist/esm/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
  295. package/dist/esm/src/wechaty/wechaty-skeleton.js +17 -6
  296. package/dist/esm/src/wechaty/wechaty-skeleton.js.map +1 -1
  297. package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
  298. package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
  299. package/dist/esm/src/wechaty-mixins/io-mixin.d.ts +12 -6
  300. package/dist/esm/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
  301. package/dist/esm/src/wechaty-mixins/io-mixin.js +8 -8
  302. package/dist/esm/src/wechaty-mixins/io-mixin.js.map +1 -1
  303. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +53 -19
  304. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  305. package/dist/esm/src/wechaty-mixins/login-mixin.js +5 -5
  306. package/dist/esm/src/wechaty-mixins/login-mixin.js.map +1 -1
  307. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +15 -10
  308. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  309. package/dist/esm/src/wechaty-mixins/misc-mixin.js +1 -1
  310. package/dist/esm/src/wechaty-mixins/misc-mixin.js.map +1 -1
  311. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
  312. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  313. package/dist/esm/src/wechaty-mixins/plugin-mixin.js +5 -5
  314. package/dist/esm/src/wechaty-mixins/plugin-mixin.js.map +1 -1
  315. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +16 -34
  316. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  317. package/dist/esm/src/wechaty-mixins/puppet-mixin.js +90 -90
  318. package/dist/esm/src/wechaty-mixins/puppet-mixin.js.map +1 -1
  319. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
  320. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  321. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
  322. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  323. package/package.json +3 -3
  324. package/src/io.ts +40 -40
  325. package/src/package-json.ts +4 -4
  326. package/src/schemas/logger.ts +1 -0
  327. package/src/schemas/mod.ts +4 -0
  328. package/src/schemas/wechaty-options.ts +21 -0
  329. package/src/user-mixins/wechatify.ts +26 -0
  330. package/src/user-modules/call.ts +6 -7
  331. package/src/user-modules/channel-card.ts +2 -3
  332. package/src/user-modules/channel.ts +2 -3
  333. package/src/user-modules/chat-history.ts +2 -3
  334. package/src/user-modules/consult-card.ts +3 -5
  335. package/src/user-modules/contact-self.ts +8 -11
  336. package/src/user-modules/contact.ts +36 -40
  337. package/src/user-modules/douyin-one-click-phone-collection.ts +2 -3
  338. package/src/user-modules/favorite.ts +1 -2
  339. package/src/user-modules/friendship.ts +11 -12
  340. package/src/user-modules/im-specific.ts +1 -2
  341. package/src/user-modules/image.ts +5 -6
  342. package/src/user-modules/location.ts +2 -3
  343. package/src/user-modules/message.ts +55 -56
  344. package/src/user-modules/mini-program.ts +2 -3
  345. package/src/user-modules/moment.ts +5 -6
  346. package/src/user-modules/post.ts +25 -25
  347. package/src/user-modules/premium-online-appointment-card.ts +2 -3
  348. package/src/user-modules/room-invitation.ts +10 -11
  349. package/src/user-modules/room.ts +43 -44
  350. package/src/user-modules/tag-group.ts +13 -14
  351. package/src/user-modules/tag.ts +21 -22
  352. package/src/user-modules/url-link.ts +2 -3
  353. package/src/user-modules/voice.ts +8 -9
  354. package/src/user-modules/wecom.ts +3 -3
  355. package/src/user-modules/wxxd-order.ts +9 -10
  356. package/src/user-modules/wxxd-product.ts +6 -7
  357. package/src/wechaty/wechaty-base.ts +17 -17
  358. package/src/wechaty/wechaty-skeleton.ts +21 -8
  359. package/src/wechaty-mixins/io-mixin.ts +8 -8
  360. package/src/wechaty-mixins/login-mixin.ts +5 -5
  361. package/src/wechaty-mixins/misc-mixin.ts +1 -1
  362. package/src/wechaty-mixins/plugin-mixin.ts +5 -5
  363. package/src/wechaty-mixins/puppet-mixin.ts +97 -86
  364. package/src/wechaty-mixins/wechatify-user-module-mixin.ts +4 -4
  365. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +0 -3
  366. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +0 -1
  367. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +0 -121
  368. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +0 -1
  369. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +0 -3
  370. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +0 -1
  371. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +0 -96
  372. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +0 -1
  373. package/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.ts +0 -144
@@ -1,6 +1,7 @@
1
1
  import { log } from '@juzi/wechaty-puppet'
2
2
  import type { Constructor } from 'clone-class'
3
3
 
4
+ import type { LoggerLike } from '../schemas/logger.js'
4
5
  import type { WechatyInterface } from '../wechaty/mod.js'
5
6
 
6
7
  const WECHATIFIED_PREFIX = 'Wechatified'
@@ -50,6 +51,31 @@ const wechatifyMixin = <TBase extends Constructor> (Base: TBase) => {
50
51
  static get wechaty (): WechatyInterface { return throwWechatifyError(this) }
51
52
  get wechaty (): WechatyInterface { return throwWechatifyError(this.constructor) }
52
53
 
54
+ /**
55
+ * Route a user module's log calls through the wechaty instance's effective
56
+ * logger (populated in puppet-mixin from `puppet.log`, brolog fallback).
57
+ *
58
+ * The try/catch guards two windows: (a) direct access on the un-wechatified
59
+ * base class (which throws) and (b) puppet-not-yet-ready inside init. In
60
+ * both cases we fall back to the module-imported brolog `log`, matching
61
+ * the historical behavior.
62
+ */
63
+ static get log (): LoggerLike {
64
+ try {
65
+ return this.wechaty.log
66
+ } catch (_) {
67
+ return log
68
+ }
69
+ }
70
+
71
+ get log (): LoggerLike {
72
+ try {
73
+ return this.wechaty.log
74
+ } catch (_) {
75
+ return log
76
+ }
77
+ }
78
+
53
79
  constructor (...args: any[]) {
54
80
  super(...args)
55
81
  if (!isWechatified(this.constructor)) {
@@ -1,7 +1,6 @@
1
1
  import * as PUPPET from '@juzi/wechaty-puppet'
2
2
 
3
3
  import type { Constructor } from 'clone-class'
4
- import { log } from '../config.js'
5
4
 
6
5
  import { validationMixin } from '../user-mixins/validation.js'
7
6
 
@@ -59,7 +58,7 @@ class CallMixin extends CallMixinBase {
59
58
  this.__direction = options.direction
60
59
  this.__status = options.status ?? (options.direction === 'outgoing' ? 'calling' : 'ringing')
61
60
 
62
- log.verbose('Call', 'constructor(%s, dir=%s, status=%s)', this.id, this.__direction, this.__status)
61
+ this.log.verbose('Call', 'constructor(%s, dir=%s, status=%s)', this.id, this.__direction, this.__status)
63
62
  }
64
63
 
65
64
  direction (): CallDirection { return this.__direction }
@@ -262,7 +261,7 @@ class CallMixin extends CallMixinBase {
262
261
  reason?: string,
263
262
  ): void {
264
263
  if (this.__status === 'ended') {
265
- log.warn('Call', '__handleSignal(%s) ignored in ended state for callId=%s', signal, this.id)
264
+ this.log.warn('Call', '__handleSignal(%s) ignored in ended state for callId=%s', signal, this.id)
266
265
  return
267
266
  }
268
267
 
@@ -310,7 +309,7 @@ class CallMixin extends CallMixinBase {
310
309
  break
311
310
 
312
311
  default:
313
- log.warn('Call', '__handleSignal() unhandled signal: %s', signal)
312
+ this.log.warn('Call', '__handleSignal() unhandled signal: %s', signal)
314
313
  break
315
314
  }
316
315
  }
@@ -351,7 +350,7 @@ class CallMixin extends CallMixinBase {
351
350
  }
352
351
 
353
352
  private __transitionTo (nextStatus: CallStatus): void {
354
- log.verbose('Call', '__transitionTo(%s) from %s', nextStatus, this.__status)
353
+ this.log.verbose('Call', '__transitionTo(%s) from %s', nextStatus, this.__status)
355
354
  this.__status = nextStatus
356
355
  }
357
356
 
@@ -386,7 +385,7 @@ export {
386
385
  class CallRecordMixin extends wechatifyMixinBase() {
387
386
 
388
387
  static async create (): Promise<CallRecordInterface> {
389
- log.verbose('CallRecord', 'create()')
388
+ this.log.verbose('CallRecord', 'create()')
390
389
 
391
390
  const payload: PUPPET.payloads.CallRecord = {
392
391
  starter: 'todo',
@@ -406,7 +405,7 @@ class CallRecordMixin extends wechatifyMixinBase() {
406
405
  public readonly payload: PUPPET.payloads.CallRecord,
407
406
  ) {
408
407
  super()
409
- log.verbose('CallRecord', 'constructor()')
408
+ this.log.verbose('CallRecord', 'constructor()')
410
409
  }
411
410
 
412
411
  async starter (): Promise<undefined | ContactInterface> {
@@ -1,7 +1,6 @@
1
1
  import type * as PUPPET from '@juzi/wechaty-puppet'
2
2
 
3
3
  import type { Constructor } from 'clone-class'
4
- import { log } from '../config.js'
5
4
 
6
5
  import { validationMixin } from '../user-mixins/validation.js'
7
6
 
@@ -17,7 +16,7 @@ class ChannelCardMixin extends wechatifyMixinBase() {
17
16
  *
18
17
  */
19
18
  static async create (): Promise<ChannelCardInterface> {
20
- log.verbose('ChannelCard', 'create()')
19
+ this.log.verbose('ChannelCard', 'create()')
21
20
 
22
21
  // TODO: get appid and username from wechat
23
22
  const payload: PUPPET.payloads.ChannelCard = {
@@ -39,7 +38,7 @@ class ChannelCardMixin extends wechatifyMixinBase() {
39
38
  public readonly payload: PUPPET.payloads.ChannelCard,
40
39
  ) {
41
40
  super()
42
- log.verbose('ChannelCard', 'constructor()')
41
+ this.log.verbose('ChannelCard', 'constructor()')
43
42
  }
44
43
 
45
44
  avatar (): undefined | string {
@@ -1,7 +1,6 @@
1
1
  import type * as PUPPET from '@juzi/wechaty-puppet'
2
2
 
3
3
  import type { Constructor } from 'clone-class'
4
- import { log } from '../config.js'
5
4
 
6
5
  import { validationMixin } from '../user-mixins/validation.js'
7
6
 
@@ -17,7 +16,7 @@ class ChannelMixin extends wechatifyMixinBase() {
17
16
  *
18
17
  */
19
18
  static async create (): Promise<ChannelInterface> {
20
- log.verbose('Channel', 'create()')
19
+ this.log.verbose('Channel', 'create()')
21
20
 
22
21
  // TODO: get appid and username from wechat
23
22
  const payload: PUPPET.payloads.Channel = {
@@ -41,7 +40,7 @@ class ChannelMixin extends wechatifyMixinBase() {
41
40
  public readonly payload: PUPPET.payloads.Channel,
42
41
  ) {
43
42
  super()
44
- log.verbose('Channel', 'constructor()')
43
+ this.log.verbose('Channel', 'constructor()')
45
44
  }
46
45
 
47
46
  avatar (): undefined | string {
@@ -1,7 +1,6 @@
1
1
  import * as PUPPET from '@juzi/wechaty-puppet'
2
2
 
3
3
  import type { Constructor } from 'clone-class'
4
- import { log } from '../config.js'
5
4
 
6
5
  import { validationMixin } from '../user-mixins/validation.js'
7
6
 
@@ -19,7 +18,7 @@ type ChatHistoryMessageType = string | LocationInterface | MiniProgramInterface
19
18
  class ChatHistoryMixin extends wechatifyMixinBase() {
20
19
 
21
20
  static async create (): Promise<ChatHistoryInterface> {
22
- log.verbose('ChatHistory', 'create()')
21
+ this.log.verbose('ChatHistory', 'create()')
23
22
 
24
23
  const payload: PUPPET.payloads.ChatHistory[] = [
25
24
  {
@@ -43,7 +42,7 @@ class ChatHistoryMixin extends wechatifyMixinBase() {
43
42
  public readonly payload: PUPPET.payloads.ChatHistory[],
44
43
  ) {
45
44
  super()
46
- log.verbose('ChatHistory', 'constructor()')
45
+ this.log.verbose('ChatHistory', 'constructor()')
47
46
  }
48
47
 
49
48
  // avatar (): FileBoxInterface {
@@ -2,8 +2,6 @@ import type * as PUPPET from '@juzi/wechaty-puppet'
2
2
 
3
3
  import type { Constructor } from 'clone-class'
4
4
 
5
- import { log } from '../config.js'
6
-
7
5
  import { validationMixin } from '../user-mixins/validation.js'
8
6
 
9
7
  import {
@@ -17,7 +15,7 @@ class ConsultCardMixin extends wechatifyMixinBase() {
17
15
  public readonly payload: PUPPET.payloads.ConsultCard,
18
16
  ) {
19
17
  super()
20
- log.verbose('ConsultCard', 'constructor()')
18
+ this.log.verbose('ConsultCard', 'constructor()')
21
19
  }
22
20
 
23
21
  static async findAll (query: {
@@ -27,7 +25,7 @@ class ConsultCardMixin extends wechatifyMixinBase() {
27
25
  page?: number,
28
26
  pageSize?: number
29
27
  }): Promise<ConsultCardInterface[]> {
30
- log.verbose('ConsultCard', 'findAll(%s)', JSON.stringify(query))
28
+ this.log.verbose('ConsultCard', 'findAll(%s)', JSON.stringify(query))
31
29
 
32
30
  const params = {
33
31
  cardType: query.cardType,
@@ -54,7 +52,7 @@ class ConsultCardMixin extends wechatifyMixinBase() {
54
52
  cardType: number,
55
53
  id: string
56
54
  }): Promise<ConsultCardInterface | undefined> {
57
- log.verbose('ConsultCard', 'find(%s)', JSON.stringify(query))
55
+ this.log.verbose('ConsultCard', 'find(%s)', JSON.stringify(query))
58
56
 
59
57
  const consultCardList = await this.findAll({
60
58
  cardType: query.cardType,
@@ -18,9 +18,6 @@
18
18
  *
19
19
  */
20
20
  import type * as PUPPET from '@juzi/wechaty-puppet'
21
- import {
22
- log,
23
- } from '@juzi/wechaty-puppet'
24
21
  import type {
25
22
  FileBoxInterface,
26
23
  } from 'file-box'
@@ -68,7 +65,7 @@ class ContactSelfMixin extends MixinBase {
68
65
  return contact as ContactSelfInterface
69
66
  }
70
67
  } catch (e) {
71
- log.silly('ContactSelf', 'find() exception: %s', (e as Error).message)
68
+ this.log.silly('ContactSelf', 'find() exception: %s', (e as Error).message)
72
69
  }
73
70
  return undefined
74
71
  }
@@ -104,7 +101,7 @@ class ContactSelfMixin extends MixinBase {
104
101
  *
105
102
  */
106
103
  public override async avatar (file?: FileBoxInterface): Promise<void | FileBoxInterface> {
107
- log.verbose('Contact', 'avatar(%s)', file ? file.name : '')
104
+ this.log.verbose('Contact', 'avatar(%s)', file ? file.name : '')
108
105
 
109
106
  if (!file) {
110
107
  const filebox = await super.avatar()
@@ -133,7 +130,7 @@ class ContactSelfMixin extends MixinBase {
133
130
  * })
134
131
  */
135
132
  public async qrcode (): Promise<string> {
136
- log.verbose('Contact', 'qrcode()')
133
+ this.log.verbose('Contact', 'qrcode()')
137
134
  if (this.id !== this.wechaty.puppet.currentUserId) {
138
135
  throw new Error('only can get qrcode for the currentUser')
139
136
  }
@@ -162,7 +159,7 @@ class ContactSelfMixin extends MixinBase {
162
159
  public override name (name: string): Promise<void>
163
160
 
164
161
  public override name (name?: string): string | Promise<void> {
165
- log.verbose('ContactSelf', 'name(%s)', name || '')
162
+ this.log.verbose('ContactSelf', 'name(%s)', name || '')
166
163
 
167
164
  if (typeof name === 'undefined') {
168
165
  return super.name()
@@ -179,7 +176,7 @@ class ContactSelfMixin extends MixinBase {
179
176
  public override realName (realName: string): Promise<void>
180
177
 
181
178
  public override realName (realName?: string): string | Promise<void> {
182
- log.verbose('ContactSelf', 'realName(%s)', realName || '')
179
+ this.log.verbose('ContactSelf', 'realName(%s)', realName || '')
183
180
 
184
181
  if (typeof realName === 'undefined') {
185
182
  return super.realName()
@@ -196,7 +193,7 @@ class ContactSelfMixin extends MixinBase {
196
193
  public override aka (aka: string): Promise<void>
197
194
 
198
195
  public override aka (aka?: string): string | Promise<void> {
199
- log.verbose('ContactSelf', 'aka(%s)', aka || '')
196
+ this.log.verbose('ContactSelf', 'aka(%s)', aka || '')
200
197
 
201
198
  if (typeof aka === 'undefined') {
202
199
  return super.aka()
@@ -225,7 +222,7 @@ class ContactSelfMixin extends MixinBase {
225
222
  * })
226
223
  */
227
224
  public async signature (signature: string): Promise<void> {
228
- log.verbose('ContactSelf', 'signature()')
225
+ this.log.verbose('ContactSelf', 'signature()')
229
226
 
230
227
  if (this.id !== this.wechaty.puppet.currentUserId) {
231
228
  throw new Error('only can change signature for user self')
@@ -235,7 +232,7 @@ class ContactSelfMixin extends MixinBase {
235
232
  }
236
233
 
237
234
  public async roomAlias (room: RoomInterface, alias?: string): Promise<void | string> {
238
- log.verbose('ContactSelf', 'roomAlias()')
235
+ this.log.verbose('ContactSelf', 'roomAlias()')
239
236
 
240
237
  if (typeof alias === 'undefined') {
241
238
  return room.alias(this)
@@ -28,10 +28,6 @@ import type {
28
28
  Constructor,
29
29
  } from 'clone-class'
30
30
 
31
- import {
32
- log,
33
- } from '../config.js'
34
-
35
31
  import { ContactEventEmitter } from '../schemas/mod.js'
36
32
 
37
33
  import {
@@ -98,7 +94,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
98
94
  static async find (
99
95
  query : string | PUPPET.filters.Contact,
100
96
  ): Promise<undefined | ContactInterface> {
101
- log.silly('Contact', 'find(%s)', JSON.stringify(query, stringifyFilter))
97
+ this.log.silly('Contact', 'find(%s)', JSON.stringify(query, stringifyFilter))
102
98
 
103
99
  if (typeof query === 'object' && query.id) {
104
100
  let contact: ContactImpl
@@ -129,7 +125,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
129
125
  }
130
126
 
131
127
  if (contactList.length > 1) {
132
- log.warn('Contact', 'find() got more than 1 result: %d total', contactList.length)
128
+ this.log.warn('Contact', 'find() got more than 1 result: %d total', contactList.length)
133
129
  }
134
130
 
135
131
  for (const [ idx, contact ] of contactList.entries()) {
@@ -138,15 +134,15 @@ class ContactMixin extends MixinBase implements SayableSayer {
138
134
  // https://github.com/wechaty/wechaty/issues/1345
139
135
  const valid = await this.wechaty.puppet.contactValidate(contact.id)
140
136
  if (valid) {
141
- log.silly('Contact', 'find() contact<id=%s> is valid, return it', idx, contact.id)
137
+ this.log.silly('Contact', 'find() contact<id=%s> is valid, return it', idx, contact.id)
142
138
  return contact
143
139
  } else {
144
- log.silly('Contact', 'find() contact<id=%s> is invalid, skip it', idx, contact.id)
140
+ this.log.silly('Contact', 'find() contact<id=%s> is invalid, skip it', idx, contact.id)
145
141
  }
146
142
 
147
143
  }
148
144
 
149
- log.warn('Contact', 'find() all of %d contacts are invalid', contactList.length)
145
+ this.log.warn('Contact', 'find() all of %d contacts are invalid', contactList.length)
150
146
  return undefined
151
147
  }
152
148
 
@@ -172,7 +168,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
172
168
  static async findAll (
173
169
  query? : string | PUPPET.filters.Contact,
174
170
  ): Promise<ContactInterface[]> {
175
- log.verbose('Contact', 'findAll(%s)', JSON.stringify(query, stringifyFilter) || '')
171
+ this.log.verbose('Contact', 'findAll(%s)', JSON.stringify(query, stringifyFilter) || '')
176
172
 
177
173
  const contactIdList: string[] = await this.wechaty.puppet.contactSearch(query)
178
174
 
@@ -242,7 +238,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
242
238
  opts? : { batch?: number },
243
239
  ): AsyncIterable<ContactInterface[]> {
244
240
  const batch = opts?.batch ?? 100
245
- log.verbose('Contact', 'findAllIter(%s, batch=%d)', JSON.stringify(query, stringifyFilter) || '', batch)
241
+ this.log.verbose('Contact', 'findAllIter(%s, batch=%d)', JSON.stringify(query, stringifyFilter) || '', batch)
246
242
 
247
243
  if (batch <= 0) {
248
244
  throw new Error(`Contact.findAllIter() batch must be positive, got ${batch}`)
@@ -263,7 +259,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
263
259
  for (const id of idChunk) {
264
260
  const payload = payloadMap.get(id)
265
261
  if (!payload) {
266
- log.silly('Contact', 'findAllIter() payload missing for id=%s, skip', id)
262
+ this.log.silly('Contact', 'findAllIter() payload missing for id=%s, skip', id)
267
263
  continue
268
264
  }
269
265
 
@@ -278,7 +274,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
278
274
  if (contactChunk.length > 0) {
279
275
  yield contactChunk
280
276
  } else {
281
- log.warn('Contact', 'findAllIter() batch all missing from payloadMap, idChunk=%j', idChunk)
277
+ this.log.warn('Contact', 'findAllIter() batch all missing from payloadMap, idChunk=%j', idChunk)
282
278
  }
283
279
  }
284
280
  }
@@ -348,7 +344,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
348
344
  // TODO
349
345
  // eslint-disable-next-line no-use-before-define
350
346
  static async delete (contact: ContactInterface): Promise<void> {
351
- log.verbose('Contact', 'static delete(%s)', contact.id)
347
+ this.log.verbose('Contact', 'static delete(%s)', contact.id)
352
348
  await this.wechaty.puppet.contactDelete(contact.id)
353
349
  }
354
350
 
@@ -367,7 +363,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
367
363
  public readonly id: string,
368
364
  ) {
369
365
  super()
370
- log.silly('Contact', `constructor(${id})`)
366
+ this.log.silly('Contact', `constructor(${id})`)
371
367
  }
372
368
 
373
369
  /**
@@ -458,10 +454,10 @@ class ContactMixin extends MixinBase implements SayableSayer {
458
454
  sayable: Sayable,
459
455
  options?: SayOptionsObject,
460
456
  ): Promise<void | MessageInterface> {
461
- log.verbose('Contact', 'say(%s)', sayable)
457
+ this.log.verbose('Contact', 'say(%s)', sayable)
462
458
 
463
459
  if (options?.mentionList) {
464
- log.warn('Contact', 'you cannot mention someone in private conversation!')
460
+ this.log.warn('Contact', 'you cannot mention someone in private conversation!')
465
461
  delete options.mentionList
466
462
  }
467
463
 
@@ -488,7 +484,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
488
484
  * call.on('ended', () => console.log('call ended'))
489
485
  */
490
486
  async call (options?: { media?: PUPPET.types.CallMediaType }): Promise<CallInterface> {
491
- log.verbose('Contact', 'call(%s)', JSON.stringify(options ?? {}))
487
+ this.log.verbose('Contact', 'call(%s)', JSON.stringify(options ?? {}))
492
488
  return (this.wechaty as any).call([ this as unknown as ContactInterface ], options)
493
489
  }
494
490
 
@@ -547,7 +543,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
547
543
  * }
548
544
  */
549
545
  async alias (newAlias?: null | string): Promise<void | undefined | string> {
550
- log.silly('Contact', 'alias(%s)',
546
+ this.log.silly('Contact', 'alias(%s)',
551
547
  newAlias === undefined
552
548
  ? ''
553
549
  : newAlias,
@@ -594,7 +590,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
594
590
  }
595
591
  } catch (e) {
596
592
  this.wechaty.emitError(e)
597
- log.error('Contact', 'alias(%s) rejected: %s', newAlias, (e as Error).message)
593
+ this.log.error('Contact', 'alias(%s) rejected: %s', newAlias, (e as Error).message)
598
594
  }
599
595
  }
600
596
 
@@ -623,7 +619,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
623
619
  async phone (): Promise<string[]>
624
620
  async phone (phoneList: string[]): Promise<void>
625
621
  async phone (phoneList?: string[]): Promise<string[] | void> {
626
- log.silly('Contact', 'phone(%s)', phoneList === undefined ? '' : JSON.stringify(phoneList))
622
+ this.log.silly('Contact', 'phone(%s)', phoneList === undefined ? '' : JSON.stringify(phoneList))
627
623
 
628
624
  if (!this.payload) {
629
625
  throw new Error('no payload')
@@ -639,14 +635,14 @@ class ContactMixin extends MixinBase implements SayableSayer {
639
635
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
640
636
  } catch (e) {
641
637
  this.wechaty.emitError(e)
642
- log.error('Contact', 'phone(%s) rejected: %s', JSON.stringify(phoneList), (e as Error).message)
638
+ this.log.error('Contact', 'phone(%s) rejected: %s', JSON.stringify(phoneList), (e as Error).message)
643
639
  }
644
640
  }
645
641
 
646
642
  async corporation (): Promise<undefined | string>
647
643
  async corporation (remark: string | null): Promise<void>
648
644
  async corporation (remark?: string | null): Promise<void | undefined | string> {
649
- log.silly('Contact', 'corporation(%s)', remark)
645
+ this.log.silly('Contact', 'corporation(%s)', remark)
650
646
 
651
647
  if (!this.payload) {
652
648
  throw new Error('no payload')
@@ -666,14 +662,14 @@ class ContactMixin extends MixinBase implements SayableSayer {
666
662
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
667
663
  } catch (e) {
668
664
  this.wechaty.emitError(e)
669
- log.error('Contact', 'corporation(%s) rejected: %s', remark, (e as Error).message)
665
+ this.log.error('Contact', 'corporation(%s) rejected: %s', remark, (e as Error).message)
670
666
  }
671
667
  }
672
668
 
673
669
  async description (): Promise<undefined | string>
674
670
  async description (newDescription: string | null): Promise<void>
675
671
  async description (newDescription?: string | null): Promise<void | undefined | string> {
676
- log.silly('Contact', 'description(%s)', newDescription)
672
+ this.log.silly('Contact', 'description(%s)', newDescription)
677
673
 
678
674
  if (!this.payload) {
679
675
  throw new Error('no payload')
@@ -689,7 +685,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
689
685
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
690
686
  } catch (e) {
691
687
  this.wechaty.emitError(e)
692
- log.error('Contact', 'description(%s) rejected: %s', newDescription, (e as Error).message)
688
+ this.log.error('Contact', 'description(%s) rejected: %s', newDescription, (e as Error).message)
693
689
  }
694
690
  }
695
691
 
@@ -723,7 +719,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
723
719
  * const isFriend = contact.friend()
724
720
  */
725
721
  friend (): undefined | boolean {
726
- log.verbose('Contact', 'friend()')
722
+ this.log.verbose('Contact', 'friend()')
727
723
  return this.payload?.friend
728
724
  }
729
725
 
@@ -813,7 +809,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
813
809
  * console.log(`Contact: ${contact.name()} with avatar file: ${name}`)
814
810
  */
815
811
  async avatar (): Promise<FileBoxInterface> {
816
- log.verbose('Contact', 'avatar()')
812
+ this.log.verbose('Contact', 'avatar()')
817
813
 
818
814
  const fileBox = await this.wechaty.puppet.contactAvatar(this.id)
819
815
  return fileBox
@@ -827,7 +823,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
827
823
  * const tags = await contact.tags()
828
824
  */
829
825
  async tags (): Promise<TagInterface[]> {
830
- log.verbose('Contact', 'tags() for %s', this)
826
+ this.log.verbose('Contact', 'tags() for %s', this)
831
827
 
832
828
  try {
833
829
  const tagPayloadList = this.payload?.tags || []
@@ -837,7 +833,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
837
833
  return tagList.filter(tag => !!tag) as TagInterface[]
838
834
  } catch (e) {
839
835
  this.wechaty.emitError(e)
840
- log.error('Contact', 'tags() exception: %s', (e as Error).message)
836
+ this.log.error('Contact', 'tags() exception: %s', (e as Error).message)
841
837
  return []
842
838
  }
843
839
  }
@@ -847,7 +843,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
847
843
  */
848
844
 
849
845
  async tag (tags: TagInterface | TagInterface[]): Promise<void> {
850
- log.verbose('Contact', 'tag(%s) for %s', JSON.stringify(tags), this)
846
+ this.log.verbose('Contact', 'tag(%s) for %s', JSON.stringify(tags), this)
851
847
 
852
848
  if (!Array.isArray(tags)) {
853
849
  tags = [ tags ]
@@ -863,7 +859,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
863
859
  */
864
860
 
865
861
  async tagRemove (tags: TagInterface | TagInterface[]): Promise<void> {
866
- log.verbose('Contact', 'tagRemove(%s) for %s', JSON.stringify(tags), this)
862
+ this.log.verbose('Contact', 'tagRemove(%s) for %s', JSON.stringify(tags), this)
867
863
 
868
864
  if (!Array.isArray(tags)) {
869
865
  tags = [ tags ]
@@ -898,20 +894,20 @@ class ContactMixin extends MixinBase implements SayableSayer {
898
894
  async ready (
899
895
  forceSync = false,
900
896
  ): Promise<void> {
901
- log.silly('Contact', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
897
+ this.log.silly('Contact', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
902
898
 
903
899
  if (!forceSync && this.isReady()) { // already ready
904
- log.silly('Contact', 'ready() isReady() true')
900
+ this.log.silly('Contact', 'ready() isReady() true')
905
901
  return
906
902
  }
907
903
 
908
904
  try {
909
905
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
910
- // log.silly('Contact', `ready() this.wechaty.puppet.contactPayload(%s) resolved`, this)
906
+ // this.log.silly('Contact', `ready() this.wechaty.puppet.contactPayload(%s) resolved`, this)
911
907
 
912
908
  } catch (e) {
913
909
  this.wechaty.emitError(e)
914
- log.verbose('Contact', 'ready() this.wechaty.puppet.contactPayload(%s) exception: %s',
910
+ this.log.verbose('Contact', 'ready() this.wechaty.puppet.contactPayload(%s) exception: %s',
915
911
  this.id,
916
912
  (e as Error).message,
917
913
  )
@@ -941,7 +937,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
941
937
  }
942
938
  } catch (e) {
943
939
  this.wechaty.emitError(e)
944
- log.error('Contact', 'readMark() exception: %s', (e as Error).message)
940
+ this.log.error('Contact', 'readMark() exception: %s', (e as Error).message)
945
941
  }
946
942
  }
947
943
 
@@ -950,7 +946,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
950
946
  await this.wechaty.puppet.endConversation(this.id)
951
947
  } catch (e) {
952
948
  this.wechaty.emitError(e)
953
- log.error('Contact', 'endConversation() exception: %s', (e as Error).message)
949
+ this.log.error('Contact', 'endConversation() exception: %s', (e as Error).message)
954
950
  }
955
951
  }
956
952
 
@@ -994,7 +990,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
994
990
  * @deprecated use `handle()` instead
995
991
  */
996
992
  weixin (): undefined | string {
997
- // log.warn('Contact', 'weixin() is deprecated, use `handle()` instead.')
993
+ // this.log.warn('Contact', 'weixin() is deprecated, use `handle()` instead.')
998
994
  // console.error(new Error().stack)
999
995
  return this.payload?.weixin
1000
996
  }
@@ -1005,7 +1001,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
1005
1001
  try {
1006
1002
  additionalInfoObj = JSON.parse(this.payload.additionalInfo)
1007
1003
  } catch (e) {
1008
- log.warn('Contact', 'additionalInfo() parse failed, additionalInfo: %s', this.payload.additionalInfo)
1004
+ this.log.warn('Contact', 'additionalInfo() parse failed, additionalInfo: %s', this.payload.additionalInfo)
1009
1005
  }
1010
1006
  }
1011
1007
  return additionalInfoObj
@@ -1,5 +1,4 @@
1
1
  import type { Constructor } from 'clone-class'
2
- import { log } from '../config.js'
3
2
 
4
3
  import { validationMixin } from '../user-mixins/validation.js'
5
4
 
@@ -15,7 +14,7 @@ class DouyinOneClickPhoneCollectionMixin extends wechatifyMixinBase() {
15
14
  *
16
15
  */
17
16
  static async create (): Promise<DouyinOneClickPhoneCollectionInterface> {
18
- log.verbose('DouyinOneClickPhoneCollection', 'create()')
17
+ this.log.verbose('DouyinOneClickPhoneCollection', 'create()')
19
18
 
20
19
  return new this({})
21
20
  }
@@ -27,7 +26,7 @@ class DouyinOneClickPhoneCollectionMixin extends wechatifyMixinBase() {
27
26
  public readonly payload: {},
28
27
  ) {
29
28
  super()
30
- log.verbose('DouyinOneClickPhoneCollection', 'constructor()')
29
+ this.log.verbose('DouyinOneClickPhoneCollection', 'constructor()')
31
30
  // Huan(202110): it is ok to create a raw one without wechaty instance
32
31
  // guardWechatifyClass.call(this, DouyinOneClickPhoneCollection)
33
32
  }
@@ -17,7 +17,6 @@
17
17
  * limitations under the License.
18
18
  *
19
19
  */
20
- import { log } from '@juzi/wechaty-puppet'
21
20
  import type { Constructor } from 'clone-class'
22
21
  import { validationMixin } from '../user-mixins/validation.js'
23
22
 
@@ -41,7 +40,7 @@ class FavoriteMixin extends wechatifyMixinBase() {
41
40
  * const tags = await wechaty.Favorite.tags()
42
41
  */
43
42
  static async tags (): Promise<TagInterface[]> {
44
- log.verbose('Favorite', 'static tags() for %s', this)
43
+ this.log.verbose('Favorite', 'static tags() for %s', this)
45
44
 
46
45
  // TODO:
47
46
  // try {