UNPKG

@juzi/wechaty-puppet-whatsapp

Version:
70 lines 2.51 kB
import { EventEmitter as EE } from 'ee-ts'; import type { MemoryCard } from '@juzi/wechaty-puppet/dist/esm/src/config'; import { CacheManager } from './data/cache-manager.js'; import type { ManagerEvents } from './manager-event.js'; import type { PuppetWhatsAppOptions } from './puppet-whatsapp.js'; import { RequestManager } from './request/request-manager.js'; import type { GroupChat, WhatsAppContact, WhatsAppMessage } from './schema/whatsapp-type.js'; import WhatsAppManager from './whatsapp/whatsapp-manager.js'; import * as PUPPET from '@juzi/wechaty-puppet'; export default class Manager extends EE<ManagerEvents> { private options; whatsAppManager: WhatsAppManager; private cacheManager?; private _requestManager?; private scheduleManager; private memory?; private fetchingMessages; private heartbeatTimer?; private selfId; constructor(options: PuppetWhatsAppOptions); getMemory(): MemoryCard; /** * Lifecycle */ start(memory?: MemoryCard): Promise<import("@juzi/whatsapp-web.js").Client>; stop(): Promise<void>; get requestManager(): RequestManager; getWhatsAppClient(): import("@juzi/whatsapp-web.js").Client; /** * LOGIC METHODS */ /** * Fetch history messages of contact or room, and then call onMessage method to emit them or not. * @param {WhatsAppContact} contactOrRoom contact or room instance */ processHistoryMessages(contactOrRoom: WhatsAppContact): Promise<void>; private fetchMessages; private filterFetchedMessages; private processFetchedMessages; getRoomChatById(roomId: string): Promise<GroupChat>; /** * Get member id list from web api * @param { PuppetWhatsApp } this whatsapp client * @param { string } roomId roomId * @returns { string[] } member id list */ syncRoomMemberList(roomId: string): Promise<string[]>; syncContactOrRoomList(): Promise<WhatsAppContact[]>; processMessage(message: WhatsAppMessage): Promise<void>; /** * Cache Section */ initCache(userId: string): Promise<void>; releaseCache(): Promise<void>; getCacheManager(): Promise<CacheManager>; /** * Schedule */ startSchedule(): void; stopSchedule(): void; /** * Heatbeat */ private startHeartbeat; private stopHeartbeat; private asystoleCount; private heartbeat; onDirty(data: PUPPET.payloads.EventDirty): Promise<void>; } //# sourceMappingURL=manager.d.ts.map