import * as PUPPET from 'wechaty-puppet'; import type { FileBoxInterface } from 'file-box'; import { FileBox } from 'file-box'; import { WebContactRawPayload, WebMessageRawPayload, WebRoomRawMember, WebRoomRawPayload } from './web-schemas.js'; export declare class PuppetWechat4u extends PUPPET.Puppet { options: PUPPET.PuppetOptions; static readonly VERSION: string; /** * Wecaht4u * * Code from: * https://github.com/nodeWechat/wechat4u/blob/46931e78bcb56899b8d2a42a37b919e7feaebbef/run-core.js * */ private wechat4u?; private scanQrCode?; private startTime; private unknownContactId; private getContactInterval; private _heartBeatTimer?; private readonly cacheMessageRawPayload; constructor(options?: PUPPET.PuppetOptions); version(): string; name(): string; onStart(): Promise; /** * At present, if a user information that does not exist is found, it will be called once. * If it is a group message, it will send a lot of information requests, and finally most of the interface requests will fail. * At present, the method of timer is used to regularly obtain user information * 1、A timer is started when the search request is triggered for the first time * 2、All requested unknown user ids will be stored in unknownContactId * 3、The timer will be executed once every 500ms, each time fetching 50 pieces of data in unknownContactId * 4、If the data of unknownContactId is empty, the timer will be cleared and wait for the next establishment * @private */ private getContactsInfo; private monkeyPatch; private _startPuppetHeart; /** * Monkey Patch for Wechat4u * - https://www.audero.it/blog/2016/12/05/monkey-patching-javascript/#what-is-monkey-patching * * What is Monkey patching? * Monkey patching is a technique to add, modify, or suppress * the default behavior of a piece of code at runtime * without changing its original source code. */ private monkeyPatchOffState; /** * @private * For issue https://github.com/wechaty/puppet-wechat/issues/107 */ private waitStable; private initHookEvents; onStop(): Promise; ding(data: string): Promise; /** * * ContactSelf * * */ contactSelfQRCode(): Promise; contactSelfName(name: string): Promise; contactSelfSignature(signature: string): Promise; /** * * Contact * */ contactAlias(contactId: string): Promise; contactAlias(contactId: string, alias: null | string): Promise; contactList(): Promise; contactAvatar(contactId: string): Promise; contactAvatar(contactId: string, file: FileBoxInterface): Promise; contactRawPayload(contactId: string): Promise; contactRawPayloadParser(rawPayload: WebContactRawPayload): Promise; /** * * Message * */ messageContact(messageId: string): Promise; messageRecall(messageId: string): Promise; messageImage(messageId: string, imageType: PUPPET.types.Image): Promise; messageFile(id: string): Promise; messageUrl(messageId: string): Promise; messageMiniProgram(messageId: string): Promise; messageRawPayload(id: string): Promise; messageRawPayloadParser(rawPayload: WebMessageRawPayload): Promise; messageSendText(conversationId: string, text: string): Promise; messageSendFile(conversationId: string, file: FileBox): Promise; messageSendContact(conversationId: string, contactId: string): Promise; messageSendUrl(conversationId: string, urlLinkPayload: PUPPET.payloads.UrlLink): Promise; messageSendMiniProgram(conversationId: string, miniProgramPayload: PUPPET.payloads.MiniProgram): Promise; messageForward(conversationid: string, messageId: string): Promise; conversationReadMark(conversationId: string, hasRead?: boolean): Promise; /** * * Room Invitation * */ roomInvitationAccept(roomInvitationId: string): Promise; roomInvitationRawPayload(roomInvitationId: string): Promise; roomInvitationRawPayloadParser(rawPayload: any): Promise; /** * * Room * */ roomRawPayload(id: string): Promise; roomRawPayloadParser(rawPayload: WebRoomRawPayload): Promise; roomList(): Promise; roomDel(roomId: string, contactId: string): Promise; roomAvatar(roomId: string): Promise; roomAdd(roomId: string, contactId: string): Promise; roomTopic(roomId: string): Promise; roomTopic(roomId: string, topic: string): Promise; roomCreate(contactIdList: string[], topic: string): Promise; roomAnnounce(roomId: string): Promise; roomAnnounce(roomId: string, text: string): Promise; roomQuit(roomId: string): Promise; roomQRCode(roomId: string): Promise; roomMemberList(roomId: string): Promise; roomMemberRawPayload(roomId: string, contactId: string): Promise; roomMemberRawPayloadParser(rawPayload: WebRoomRawMember): Promise; /** * * Friendship * */ friendshipSearchPhone(phone: string): Promise; friendshipSearchWeixin(weixin: string): Promise; friendshipAdd(contactId: string, hello: string): Promise; friendshipAccept(friendshipId: string): Promise; friendshipRawPayload(id: string): Promise; friendshipRawPayloadParser(rawPayload: any): Promise; /** * * Tag * */ tagContactAdd(tagId: string, contactId: string): Promise; tagContactRemove(tagId: string, contactId: string): Promise; tagContactDelete(tagId: string): Promise; tagContactList(contactId?: string): Promise; contactCorporationRemark(..._: any[]): never; contactDescription(..._: any[]): never; contactPhone(..._: any[]): never; messageLocation(messageId: string): Promise; messageSendLocation(conversationId: string, locationPayload: PUPPET.payloads.Location): Promise; } export default PuppetWechat4u; //# sourceMappingURL=puppet-wechat4u.d.ts.map