UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

123 lines 7.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wechatifyUserModuleMixin = void 0; const wechaty_puppet_1 = require("@juzi/wechaty-puppet"); const mod_js_1 = require("../user-modules/mod.js"); const wechatifyUserModuleMixin = (mixinBase) => { wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'wechatifyUserModuleMixin(%s)', mixinBase.name); class WechatifyUserModuleMixin extends mixinBase { constructor(...args) { wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'constructor()'); super(...args); } __wechatifiedContact; __wechatifiedContactSelf; __wechatifiedDelay; __wechatifiedFriendship; __wechatifiedImage; __wechatifiedLocation; __wechatifiedMessage; __wechatifiedMiniProgram; __wechatifiedPost; __wechatifiedRoom; __wechatifiedRoomInvitation; __wechatifiedTag; __wechatifiedTagGroup; __wechatifiedUrlLink; __wechatifiedChannel; __wechatifiedChannelCard; __wechatifiedConsultCard; __wechatifiedPremiumOnlineAppointmentCard; __wechatifiedMoment; __wechatifiedCallRecord; __wechatifiedChatHistory; __wechatifiedWecom; __wechatifiedDouyinOneClickPhoneCollection; __wechatifiedImSpecific; __wechatifiedWxxdProduct; __wechatifiedWxxdOrder; get Contact() { return guardWechatify(this.__wechatifiedContact); } get ContactSelf() { return guardWechatify(this.__wechatifiedContactSelf); } get Delay() { return guardWechatify(this.__wechatifiedDelay); } get Friendship() { return guardWechatify(this.__wechatifiedFriendship); } get Image() { return guardWechatify(this.__wechatifiedImage); } get Location() { return guardWechatify(this.__wechatifiedLocation); } get Message() { return guardWechatify(this.__wechatifiedMessage); } get MiniProgram() { return guardWechatify(this.__wechatifiedMiniProgram); } get Post() { return guardWechatify(this.__wechatifiedPost); } get Room() { return guardWechatify(this.__wechatifiedRoom); } get RoomInvitation() { return guardWechatify(this.__wechatifiedRoomInvitation); } get Tag() { return guardWechatify(this.__wechatifiedTag); } get TagGroup() { return guardWechatify(this.__wechatifiedTagGroup); } get UrlLink() { return guardWechatify(this.__wechatifiedUrlLink); } get Channel() { return guardWechatify(this.__wechatifiedChannel); } get ChannelCard() { return guardWechatify(this.__wechatifiedChannelCard); } get ConsultCard() { return guardWechatify(this.__wechatifiedConsultCard); } get PremiumOnlineAppointmentCard() { return guardWechatify(this.__wechatifiedPremiumOnlineAppointmentCard); } get Moment() { return guardWechatify(this.__wechatifiedMoment); } get CallRecord() { return guardWechatify(this.__wechatifiedCallRecord); } get ChatHistory() { return guardWechatify(this.__wechatifiedChatHistory); } get Wecom() { return guardWechatify(this.__wechatifiedWecom); } get DouyinOneClickPhoneCollection() { return guardWechatify(this.__wechatifiedDouyinOneClickPhoneCollection); } get ImSpecific() { return guardWechatify(this.__wechatifiedImSpecific); } get WxxdProduct() { return guardWechatify(this.__wechatifiedWxxdProduct); } get WxxdOrder() { return guardWechatify(this.__wechatifiedWxxdOrder); } async init() { wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'init()'); await super.init(); /** * Skip if already wechatified */ if (this.__wechatifiedMessage) { wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'init() Wechaty User Module (WUM)s have already wechatified: skip'); return; } wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ...'); /** * Wechatify User Classes * 1. Binding the wechaty instance to the class * * Huan(202110): FIXME: remove any */ this.__wechatifiedContact = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ContactImpl)(this); this.__wechatifiedContactSelf = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ContactSelfImpl)(this); this.__wechatifiedDelay = (0, mod_js_1.wechatifyUserModule)(mod_js_1.DelayImpl)(this); this.__wechatifiedFriendship = (0, mod_js_1.wechatifyUserModule)(mod_js_1.FriendshipImpl)(this); this.__wechatifiedImage = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ImageImpl)(this); this.__wechatifiedLocation = (0, mod_js_1.wechatifyUserModule)(mod_js_1.LocationImpl)(this); this.__wechatifiedMessage = (0, mod_js_1.wechatifyUserModule)(mod_js_1.MessageImpl)(this); this.__wechatifiedMiniProgram = (0, mod_js_1.wechatifyUserModule)(mod_js_1.MiniProgramImpl)(this); this.__wechatifiedPost = (0, mod_js_1.wechatifyUserModule)(mod_js_1.PostImpl)(this); this.__wechatifiedRoom = (0, mod_js_1.wechatifyUserModule)(mod_js_1.RoomImpl)(this); this.__wechatifiedRoomInvitation = (0, mod_js_1.wechatifyUserModule)(mod_js_1.RoomInvitationImpl)(this); this.__wechatifiedTag = (0, mod_js_1.wechatifyUserModule)(mod_js_1.TagImpl)(this); this.__wechatifiedTagGroup = (0, mod_js_1.wechatifyUserModule)(mod_js_1.TagGroupImpl)(this); this.__wechatifiedUrlLink = (0, mod_js_1.wechatifyUserModule)(mod_js_1.UrlLinkImpl)(this); this.__wechatifiedChannel = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ChannelImpl)(this); this.__wechatifiedChannelCard = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ChannelCardImpl)(this); this.__wechatifiedConsultCard = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ConsultCardImpl)(this); this.__wechatifiedPremiumOnlineAppointmentCard = (0, mod_js_1.wechatifyUserModule)(mod_js_1.PremiumOnlineAppointmentCardImpl)(this); this.__wechatifiedMoment = (0, mod_js_1.wechatifyUserModule)(mod_js_1.MomentImpl)(this); this.__wechatifiedCallRecord = (0, mod_js_1.wechatifyUserModule)(mod_js_1.CallRecordImpl)(this); this.__wechatifiedChatHistory = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ChatHistoryImpl)(this); this.__wechatifiedWecom = (0, mod_js_1.wechatifyUserModule)(mod_js_1.WecomImpl)(this); this.__wechatifiedDouyinOneClickPhoneCollection = (0, mod_js_1.wechatifyUserModule)(mod_js_1.DouyinOneClickPhoneCollectionImpl)(this); this.__wechatifiedImSpecific = (0, mod_js_1.wechatifyUserModule)(mod_js_1.ImSpecificImpl)(this); this.__wechatifiedWxxdProduct = (0, mod_js_1.wechatifyUserModule)(mod_js_1.WxxdProductImpl)(this); this.__wechatifiedWxxdOrder = (0, mod_js_1.wechatifyUserModule)(mod_js_1.WxxdOrderImpl)(this); wechaty_puppet_1.log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done'); } } return WechatifyUserModuleMixin; }; exports.wechatifyUserModuleMixin = wechatifyUserModuleMixin; /** * Huan(202008): we will bind the wechaty puppet with user modules (Contact, Room, etc) together inside the start() method */ function guardWechatify(userModule) { if (userModule) { return userModule; } throw new Error('Wechaty User Module (WUM, for example: wechaty.Room) can not be used before wechaty.start()!'); } //# sourceMappingURL=wechatify-user-module-mixin.js.map