@yui-bails/yui-bails 1.2.0 → 1.4.0

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 (69) hide show
  1. package/README.md +221 -0
  2. package/lib/Socket/connect-bot.d.ts +860 -0
  3. package/lib/Socket/connect-bot.d.ts.map +1 -0
  4. package/lib/Socket/connect-bot.js +95 -0
  5. package/lib/Socket/connect-bot.js.map +1 -0
  6. package/lib/Socket/index.d.ts +69 -0
  7. package/lib/Socket/index.d.ts.map +1 -1
  8. package/lib/Socket/index.js +33 -0
  9. package/lib/Socket/index.js.map +1 -1
  10. package/lib/Socket/messages-send.js +1 -1
  11. package/lib/Socket/messages-send.js.map +1 -1
  12. package/lib/Socket/session-manager.d.ts +73 -0
  13. package/lib/Socket/session-manager.d.ts.map +1 -1
  14. package/lib/Socket/session-manager.js +9 -3
  15. package/lib/Socket/session-manager.js.map +1 -1
  16. package/lib/Types/Message.d.ts +21 -0
  17. package/lib/Types/Message.d.ts.map +1 -1
  18. package/lib/Types/Socket.d.ts +5 -0
  19. package/lib/Types/Socket.d.ts.map +1 -1
  20. package/lib/Types/Socket.js.map +1 -1
  21. package/lib/Utils/banner.d.ts +1 -1
  22. package/lib/Utils/banner.js +1 -1
  23. package/lib/Utils/commands.d.ts +99 -0
  24. package/lib/Utils/commands.d.ts.map +1 -0
  25. package/lib/Utils/commands.js +176 -0
  26. package/lib/Utils/commands.js.map +1 -0
  27. package/lib/Utils/cooldown.d.ts +17 -0
  28. package/lib/Utils/cooldown.d.ts.map +1 -0
  29. package/lib/Utils/cooldown.js +42 -0
  30. package/lib/Utils/cooldown.js.map +1 -0
  31. package/lib/Utils/experimental-buttons.d.ts +24 -0
  32. package/lib/Utils/experimental-buttons.d.ts.map +1 -0
  33. package/lib/Utils/experimental-buttons.js +27 -0
  34. package/lib/Utils/experimental-buttons.js.map +1 -0
  35. package/lib/Utils/helpers.d.ts +17 -0
  36. package/lib/Utils/helpers.d.ts.map +1 -1
  37. package/lib/Utils/helpers.js +28 -2
  38. package/lib/Utils/helpers.js.map +1 -1
  39. package/lib/Utils/index.d.ts +6 -0
  40. package/lib/Utils/index.d.ts.map +1 -1
  41. package/lib/Utils/index.js +6 -0
  42. package/lib/Utils/index.js.map +1 -1
  43. package/lib/Utils/messages-media.d.ts +38 -0
  44. package/lib/Utils/messages-media.d.ts.map +1 -1
  45. package/lib/Utils/messages-media.js +51 -16
  46. package/lib/Utils/messages-media.js.map +1 -1
  47. package/lib/Utils/messages.d.ts.map +1 -1
  48. package/lib/Utils/messages.js +31 -1
  49. package/lib/Utils/messages.js.map +1 -1
  50. package/lib/Utils/pairing.d.ts +28 -0
  51. package/lib/Utils/pairing.d.ts.map +1 -0
  52. package/lib/Utils/pairing.js +102 -0
  53. package/lib/Utils/pairing.js.map +1 -0
  54. package/lib/Utils/scheduler.d.ts +75 -0
  55. package/lib/Utils/scheduler.d.ts.map +1 -0
  56. package/lib/Utils/scheduler.js +265 -0
  57. package/lib/Utils/scheduler.js.map +1 -0
  58. package/lib/Utils/send-extras.d.ts +128 -0
  59. package/lib/Utils/send-extras.d.ts.map +1 -0
  60. package/lib/Utils/send-extras.js +219 -0
  61. package/lib/Utils/send-extras.js.map +1 -0
  62. package/lib/Utils/send-queue.d.ts.map +1 -1
  63. package/lib/Utils/send-queue.js +18 -2
  64. package/lib/Utils/send-queue.js.map +1 -1
  65. package/lib/index.d.ts +1 -0
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/index.js +1 -0
  68. package/lib/index.js.map +1 -1
  69. package/package.json +1 -1
@@ -0,0 +1,860 @@
1
+ import { Boom } from '@hapi/boom';
2
+ import type { UserFacingSocketConfig } from '../Types/index.js';
3
+ import { type YuiSocket } from './session-manager.js';
4
+ export type ConnectBotOptions = {
5
+ /** folder where the login is saved (created if missing). Never use `.`, `/` or your home folder */
6
+ authDir: string;
7
+ /** phone number to link with a pairing code (with country code). Without it, `onQR` gets a QR to scan */
8
+ number?: string;
9
+ /** socket config (logger, sendQueue, prettyLogs…) */
10
+ config?: Partial<UserFacingSocketConfig>;
11
+ /** called every time a socket is created, also after a reconnect: attach your event handlers here */
12
+ setup?: (sock: YuiSocket) => void | Promise<void>;
13
+ /** the pairing code, ready to type on the phone. By default it is printed in the console */
14
+ onCode?: (info: {
15
+ code: string;
16
+ formatted: string;
17
+ number: string;
18
+ }) => void;
19
+ /** a QR string to scan (draw it with a QR library). Used when no `number` is given */
20
+ onQR?: (qr: string) => void;
21
+ /** the account is connected */
22
+ onOpen?: (sock: YuiSocket) => void;
23
+ /** the connection closed. `message` says why and what to do, in Spanish */
24
+ onClose?: (info: {
25
+ reason: number | undefined;
26
+ willReconnect: boolean;
27
+ message: string;
28
+ }) => void;
29
+ onError?: (error: unknown, message: string) => void;
30
+ /** reconnect by itself (not after a logout). Default true */
31
+ reconnect?: boolean;
32
+ /** extra tries when WhatsApp times out or rate-limits the pairing code. Default 2 */
33
+ pairingRetries?: number;
34
+ /** where the default messages go. Default console.log */
35
+ log?: (line: string) => void;
36
+ /** replaceable for tests */
37
+ makeSocket?: (config: UserFacingSocketConfig) => YuiSocket;
38
+ sleep?: (ms: number) => Promise<void>;
39
+ };
40
+ /**
41
+ * Starts one WhatsApp account with everything needed already wired: login folder, pairing code
42
+ * (or QR), reconnection with waits, and error messages in plain Spanish.
43
+ *
44
+ * ```js
45
+ * const bot = await connectBot({ authDir: './sesion', number: '51912345678', setup: sock => { ... } })
46
+ * const sock = await bot.ready // resolves when it is connected
47
+ * ```
48
+ */
49
+ export declare const connectBot: (options: ConnectBotOptions) => Promise<{
50
+ /** resolves with the socket the first time the account is connected */
51
+ ready: Promise<{
52
+ communityMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
53
+ communityCreate: (subject: string, body: string) => Promise<import("../index.js").GroupMetadata | null>;
54
+ communityCreateGroup: (subject: string, participants: string[], parentCommunityJid: string) => Promise<import("../index.js").GroupMetadata | null>;
55
+ communityLeave: (id: string) => Promise<void>;
56
+ communityUpdateSubject: (jid: string, subject: string) => Promise<void>;
57
+ communityLinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
58
+ communityUnlinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
59
+ communityFetchLinkedGroups: (jid: string) => Promise<{
60
+ communityJid: string;
61
+ isCommunity: boolean;
62
+ linkedGroups: {
63
+ id: string | undefined;
64
+ subject: string;
65
+ creation: number | undefined;
66
+ owner: string | undefined;
67
+ size: number | undefined;
68
+ }[];
69
+ }>;
70
+ communityRequestParticipantsList: (jid: string) => Promise<{
71
+ [key: string]: string;
72
+ }[]>;
73
+ communityRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
74
+ status: string;
75
+ jid: string | undefined;
76
+ }[]>;
77
+ communityParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
78
+ status: string;
79
+ jid: string | undefined;
80
+ content: import("../index.js").BinaryNode;
81
+ }[]>;
82
+ communityUpdateDescription: (jid: string, description?: string) => Promise<void>;
83
+ communityInviteCode: (jid: string) => Promise<string | undefined>;
84
+ communityRevokeInvite: (jid: string) => Promise<string | undefined>;
85
+ communityAcceptInvite: (code: string) => Promise<string | undefined>;
86
+ communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>;
87
+ communityAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
88
+ communityGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
89
+ communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
90
+ communitySettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
91
+ communityMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
92
+ communityJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
93
+ communityFetchAllParticipating: () => Promise<{
94
+ [_: string]: import("../index.js").GroupMetadata;
95
+ }>;
96
+ logger: import("../Utils/logger.js").ILogger;
97
+ getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../index.js").OrderDetails>;
98
+ getCatalog: ({ jid, limit, cursor }: import("../index.js").GetCatalogOptions) => Promise<{
99
+ products: import("../index.js").Product[];
100
+ nextPageCursor: string | undefined;
101
+ }>;
102
+ getCollections: (jid?: string, limit?: number) => Promise<{
103
+ collections: import("../index.js").CatalogCollection[];
104
+ }>;
105
+ productCreate: (create: import("../index.js").ProductCreate) => Promise<import("../index.js").Product>;
106
+ productDelete: (productIds: string[]) => Promise<{
107
+ deleted: number;
108
+ }>;
109
+ productUpdate: (productId: string, update: import("../index.js").ProductUpdate) => Promise<import("../index.js").Product>;
110
+ updateBussinesProfile: (args: import("../Types/Bussines.js").UpdateBussinesProfileProps) => Promise<any>;
111
+ updateCoverPhoto: (photo: import("../index.js").WAMediaUpload) => Promise<number>;
112
+ removeCoverPhoto: (id: string) => Promise<any>;
113
+ sendMessageAck: (node: import("../index.js").BinaryNode, errorCode?: number) => Promise<void>;
114
+ sendRetryRequest: (node: import("../index.js").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
115
+ rejectCall: (callId: string, callFrom: string) => Promise<void>;
116
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../index.js").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
117
+ requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, msgData?: Partial<import("../index.js").WAMessage>) => Promise<string | undefined>;
118
+ messageRetryManager: import("../index.js").MessageRetryManager | null;
119
+ userDevicesCache: import("../index.js").PossiblyExtendedCacheStore | import("@cacheable/node-cache").NodeCache<import("../index.js").JidWithDevice[]>;
120
+ devicesMutex: {
121
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
122
+ };
123
+ issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
124
+ assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
125
+ relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../index.js").MessageRelayOptions) => Promise<string>;
126
+ sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
127
+ sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
128
+ readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
129
+ refreshMediaConn: (forceGet?: boolean) => Promise<import("../index.js").MediaConnInfo>;
130
+ getMediaHost: () => string;
131
+ waUploadToServer: import("../index.js").WAMediaUploadFunction;
132
+ fetchPrivacySettings: (force?: boolean) => Promise<{
133
+ [_: string]: string;
134
+ }>;
135
+ sendPeerDataOperationMessage: (pdoMessage: import("../index.js").proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
136
+ createParticipantNodes: (recipientJids: string[], message: import("../index.js").proto.IMessage, extraAttrs?: import("../index.js").BinaryNode["attrs"], dsmMessage?: import("../index.js").proto.IMessage) => Promise<{
137
+ nodes: import("../index.js").BinaryNode[];
138
+ shouldIncludeDeviceIdentity: boolean;
139
+ }>;
140
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<(import("../index.js").JidWithDevice & {
141
+ jid: string;
142
+ })[]>;
143
+ updateMemberLabel: (jid: string, memberLabel: string) => Promise<string>;
144
+ updateMediaMessage: (message: import("../index.js").WAMessage) => Promise<import("../index.js").WAMessage>;
145
+ sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
146
+ newsletterCreate: (name: string, description?: string) => Promise<import("../index.js").NewsletterMetadata>;
147
+ newsletterUpdate: (jid: string, updates: import("../index.js").NewsletterUpdate) => Promise<unknown>;
148
+ newsletterSubscribers: (jid: string) => Promise<{
149
+ subscribers: number;
150
+ }>;
151
+ newsletterMetadata: (type: "invite" | "jid", key: string) => Promise<import("../index.js").NewsletterMetadata | null>;
152
+ newsletterFollow: (jid: string) => Promise<unknown>;
153
+ newsletterUnfollow: (jid: string) => Promise<unknown>;
154
+ newsletterMute: (jid: string) => Promise<unknown>;
155
+ newsletterUnmute: (jid: string) => Promise<unknown>;
156
+ newsletterUpdateName: (jid: string, name: string) => Promise<unknown>;
157
+ newsletterUpdateDescription: (jid: string, description: string) => Promise<unknown>;
158
+ newsletterUpdatePicture: (jid: string, content: import("../index.js").WAMediaUpload) => Promise<unknown>;
159
+ newsletterRemovePicture: (jid: string) => Promise<unknown>;
160
+ newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise<void>;
161
+ newsletterFetchMessages: (jid: string, count: number, since: number, after: number) => Promise<any>;
162
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
163
+ duration: string;
164
+ } | null>;
165
+ newsletterAdminCount: (jid: string) => Promise<number>;
166
+ newsletterChangeOwner: (jid: string, newOwnerJid: string) => Promise<void>;
167
+ newsletterDemote: (jid: string, userJid: string) => Promise<void>;
168
+ newsletterDelete: (jid: string) => Promise<void>;
169
+ groupMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
170
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../index.js").GroupMetadata>;
171
+ groupLeave: (id: string) => Promise<void>;
172
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
173
+ groupRequestParticipantsList: (jid: string) => Promise<{
174
+ [key: string]: string;
175
+ }[]>;
176
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
177
+ status: string;
178
+ jid: string | undefined;
179
+ }[]>;
180
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
181
+ status: string;
182
+ jid: string | undefined;
183
+ content: import("../index.js").BinaryNode;
184
+ }[]>;
185
+ groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
186
+ groupInviteCode: (jid: string) => Promise<string | undefined>;
187
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>;
188
+ groupAcceptInvite: (code: string) => Promise<string | undefined>;
189
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
190
+ groupAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
191
+ groupGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
192
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
193
+ groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
194
+ groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
195
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
196
+ groupFetchAllParticipating: () => Promise<{
197
+ [_: string]: import("../index.js").GroupMetadata;
198
+ }>;
199
+ serverProps: {
200
+ privacyTokenOn1to1: boolean;
201
+ profilePicPrivacyToken: boolean;
202
+ lidTrustedTokenIssueToLid: boolean;
203
+ };
204
+ createCallLink: (type: "audio" | "video", event?: {
205
+ startTime: number;
206
+ }, timeoutMs?: number) => Promise<string | undefined>;
207
+ getBotListV2: () => Promise<import("../index.js").BotListInfo[]>;
208
+ messageMutex: {
209
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
210
+ };
211
+ receiptMutex: {
212
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
213
+ };
214
+ appStatePatchMutex: {
215
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
216
+ };
217
+ notificationMutex: {
218
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
219
+ };
220
+ upsertMessage: (msg: import("../index.js").WAMessage, type: import("../index.js").MessageUpsertType) => Promise<void>;
221
+ appPatch: (patchCreate: import("../index.js").WAPatchCreate) => Promise<void>;
222
+ sendPresenceUpdate: (type: import("../index.js").WAPresence, toJid?: string) => Promise<void>;
223
+ presenceSubscribe: (toJid: string) => Promise<void>;
224
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
225
+ fetchBlocklist: () => Promise<(string | undefined)[]>;
226
+ fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
227
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
228
+ updateProfilePicture: (jid: string, content: import("../index.js").WAMediaUpload, dimensions?: {
229
+ width: number;
230
+ height: number;
231
+ }) => Promise<void>;
232
+ removeProfilePicture: (jid: string) => Promise<void>;
233
+ updateProfileStatus: (status: string) => Promise<void>;
234
+ updateProfileName: (name: string) => Promise<void>;
235
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
236
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
237
+ updateCallPrivacy: (value: import("../index.js").WAPrivacyCallValue) => Promise<void>;
238
+ updateMessagesPrivacy: (value: import("../index.js").WAPrivacyMessagesValue) => Promise<void>;
239
+ updateLastSeenPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
240
+ updateOnlinePrivacy: (value: import("../index.js").WAPrivacyOnlineValue) => Promise<void>;
241
+ updateProfilePicturePrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
242
+ updateStatusPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
243
+ updateReadReceiptsPrivacy: (value: import("../index.js").WAReadReceiptsValue) => Promise<void>;
244
+ updateGroupsAddPrivacy: (value: import("../index.js").WAPrivacyGroupAddValue) => Promise<void>;
245
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>;
246
+ getBusinessProfile: (jid: string) => Promise<import("../index.js").WABusinessProfile | void>;
247
+ resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
248
+ chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise<void>;
249
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
250
+ addOrEditContact: (jid: string, contact: import("../index.js").proto.SyncActionValue.IContactAction) => Promise<void>;
251
+ removeContact: (jid: string) => Promise<void>;
252
+ placeholderResendCache: import("../index.js").CacheStore;
253
+ addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
254
+ addChatLabel: (jid: string, labelId: string) => Promise<void>;
255
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>;
256
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
257
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
258
+ star: (jid: string, messages: {
259
+ id: string;
260
+ fromMe?: boolean;
261
+ }[], star: boolean) => Promise<void>;
262
+ addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
263
+ removeQuickReply: (timestamp: string) => Promise<void>;
264
+ type: "md";
265
+ ws: import("./Client/index.js").WebSocketClient;
266
+ ev: import("../index.js").YuiEventEmitter & {
267
+ process(handler: (events: Partial<import("../index.js").YuiEventMap>) => void | Promise<void>): () => void;
268
+ buffer(): void;
269
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
270
+ flush(): boolean;
271
+ isBuffering(): boolean;
272
+ destroy(): void;
273
+ };
274
+ authState: {
275
+ creds: import("../index.js").AuthenticationCreds;
276
+ keys: import("../index.js").SignalKeyStoreWithTransaction;
277
+ };
278
+ signalRepository: import("../index.js").SignalRepositoryWithLIDStore;
279
+ user: import("../index.js").Contact | undefined;
280
+ generateMessageTag: () => string;
281
+ query: (node: import("../index.js").BinaryNode, timeoutMs?: number) => Promise<any>;
282
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
283
+ waitForSocketOpen: () => Promise<void>;
284
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
285
+ sendNode: (frame: import("../index.js").BinaryNode) => Promise<void>;
286
+ logout: (msg?: string) => Promise<void>;
287
+ end: (error: Error | undefined) => Promise<void>;
288
+ registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
289
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
290
+ uploadPreKeys: (count?: number) => Promise<void>;
291
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
292
+ digestKeyBundle: () => Promise<void>;
293
+ rotateSignedPreKey: () => Promise<void>;
294
+ requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
295
+ updateServerTimeOffset: ({ attrs }: import("../index.js").BinaryNode) => void;
296
+ sendUnifiedSession: () => Promise<void>;
297
+ wamBuffer: import("../index.js").BinaryInfo;
298
+ waitForConnectionUpdate: (check: (u: Partial<import("../index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
299
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
300
+ executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
301
+ onWhatsApp: (...phoneNumber: string[]) => Promise<{
302
+ jid: string;
303
+ exists: boolean;
304
+ }[] | undefined>;
305
+ fetchAccountReachoutTimelock: () => Promise<import("../index.js").ReachoutTimelockState>;
306
+ fetchNewChatMessageCap: () => Promise<import("../index.js").NewChatMessageCapInfo>;
307
+ } & {
308
+ getSender: (msg: import("../index.js").WAMessage) => Promise<import("../index.js").SenderInfo>;
309
+ reply: (msg: import("../index.js").WAMessage, content: string | {
310
+ [x: string]: unknown;
311
+ }, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
312
+ react: (msg: import("../index.js").WAMessage, emoji: string) => Promise<import("../index.js").WAMessage | undefined>;
313
+ sendSafe: (jid: string, content: string | {
314
+ [x: string]: unknown;
315
+ }, options?: import("../index.js").MiscMessageGenerationOptions, { timeoutMs }?: import("../index.js").SendSafeOptions) => Promise<import("../index.js").SendResult>;
316
+ sendButtons: (jid: string, { buttons, ...rest }: import("../index.js").SendButtonsOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
317
+ sendCarousel: (jid: string, { cards, ...rest }: import("../index.js").SendCarouselOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
318
+ disableButtons: (msg: import("../index.js").WAMessage, text?: string) => Promise<boolean>;
319
+ sendList: (jid: string, { sections, ...rest }: import("../index.js").SendListOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
320
+ sendPoll: (jid: string, name: string, values: string[], poll?: Partial<Omit<import("../index.js").PollMessageOptions, "name" | "values">>, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
321
+ sendQuiz: (jid: string, name: string, values: string[], correctAnswer: string | number, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
322
+ getPollVotes: (pollKey: import("../index.js").WAMessageKey | string) => {
323
+ pollKey: import("../index.js").WAMessageKey;
324
+ pollName: string;
325
+ votes: {
326
+ name: string;
327
+ voters: string[];
328
+ }[];
329
+ } | undefined;
330
+ getQuizResult: (pollKey: import("../index.js").WAMessageKey | string) => {
331
+ pollKey: import("../index.js").WAMessageKey;
332
+ pollName: string;
333
+ correct: string;
334
+ right: string[];
335
+ wrong: string[];
336
+ votes: {
337
+ name: string;
338
+ voters: string[];
339
+ }[];
340
+ } | undefined;
341
+ downloadMedia: (msg: import("../index.js").WAMessage, options?: import("../index.js").DownloadMediaOptions) => Promise<Buffer>;
342
+ } & {
343
+ onReply: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
344
+ onButton: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
345
+ onList: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
346
+ awaitReply: (msg: import("../index.js").WAMessage, { timeoutMs, filter }?: import("../index.js").AwaitReplyOptions) => Promise<import("../index.js").WAMessage | undefined>;
347
+ } & {
348
+ commands: {
349
+ add: (definition: import("../index.js").CommandDefinition) => /*elided*/ any;
350
+ remove: (name: string) => boolean;
351
+ get: (name: string) => import("../index.js").CommandDefinition | undefined;
352
+ list: () => import("../index.js").CommandDefinition[];
353
+ cooldowns: {
354
+ use: (user: string, action: string, ms: number) => number;
355
+ left: (user: string, action: string) => number;
356
+ reset: (user: string, action?: string) => void;
357
+ clear: () => void;
358
+ };
359
+ handle: (msg: import("../index.js").WAMessage) => Promise<boolean>;
360
+ listen: () => () => void | undefined;
361
+ };
362
+ schedule: {
363
+ at: (when: Date | number | string, jid: string, content: {
364
+ [x: string]: unknown;
365
+ }) => string;
366
+ after: (delay: string | number, jid: string, content: {
367
+ [x: string]: unknown;
368
+ }) => string;
369
+ every: (interval: string | number, jid: string, content: {
370
+ [x: string]: unknown;
371
+ }, extra?: {
372
+ times?: number;
373
+ }) => string;
374
+ cron: (expression: string, jid: string, content: {
375
+ [x: string]: unknown;
376
+ }, extra?: {
377
+ times?: number;
378
+ }) => string;
379
+ list: () => import("../index.js").ScheduledJob[];
380
+ cancel: (id: string) => boolean;
381
+ clear: () => void;
382
+ start: () => void;
383
+ stop: () => void;
384
+ flush: () => Promise<void>;
385
+ };
386
+ cooldown: (user: string, action: string, ms: number) => number;
387
+ sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
388
+ sendMessageNow: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
389
+ messageStore: {
390
+ save: (msg: Pick<import("../index.js").WAMessage, "key" | "message"> | null | undefined) => void;
391
+ get: (key: Pick<import("../index.js").WAMessageKey, "id">) => import("../index.js").proto.IMessage | undefined;
392
+ readonly size: number;
393
+ clear: () => void;
394
+ } | undefined;
395
+ groupCache: {
396
+ get: (jid: string) => import("../index.js").GroupMetadata | undefined;
397
+ set: (jid: string, data: import("../index.js").GroupMetadata) => void;
398
+ delete: (jid: string) => boolean;
399
+ clear: () => void;
400
+ readonly size: number;
401
+ } | undefined;
402
+ sendContact: (jid: string, contacts: import("../index.js").ContactInput | import("../index.js").ContactInput[] | string, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
403
+ sendLocation: (jid: string, { latitude, longitude, name, address }: import("../index.js").LocationInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
404
+ sendAlbum: (jid: string, items: import("../index.js").AlbumItem[], options?: import("../index.js").MiscMessageGenerationOptions) => Promise<{
405
+ album: import("../index.js").WAMessage;
406
+ items: (import("../index.js").WAMessage | undefined)[];
407
+ }>;
408
+ sendEvent: (jid: string, event: import("../index.js").EventInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
409
+ sendLong: (jid: string, text: string, long?: import("../index.js").SendLongOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<(import("../index.js").WAMessage | undefined)[]>;
410
+ sendImagePoll: (jid: string, poll: import("../index.js").ImagePollInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<{
411
+ album: {
412
+ album: import("../index.js").WAMessage;
413
+ items: (import("../index.js").WAMessage | undefined)[];
414
+ };
415
+ poll: import("../index.js").WAMessage | undefined;
416
+ }>;
417
+ sendScheduledCall: (jid: string, call: import("../index.js").ScheduledCallInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
418
+ sendStatusMention: (content: Record<string, any>, { mentions, backgroundColor, font }: import("../index.js").StatusMentionOptions) => Promise<import("../index.js").WAMessage>;
419
+ ask: (to: import("../index.js").WAMessage, question: string, { timeoutMs }?: import("../index.js").AskOptions) => Promise<string | undefined>;
420
+ confirm: (msg: import("../index.js").WAMessage, text: string, options?: import("../index.js").ConfirmOptions) => Promise<boolean>;
421
+ paginate: (msg: import("../index.js").WAMessage, items: unknown[], options?: import("../index.js").PaginateOptions) => Promise<import("../index.js").WAMessage | undefined>;
422
+ menu: (msg: import("../index.js").WAMessage, definition: import("../index.js").MenuDefinition) => Promise<import("../index.js").WAMessage | undefined>;
423
+ sendGuardedButtons: (msg: import("../index.js").WAMessage, options: import("../index.js").GuardedButtonsOptions, onTap: (tap: import("../index.js").TapContext & {
424
+ id: string;
425
+ }) => void | Promise<void>) => Promise<import("../index.js").WAMessage | undefined>;
426
+ sendRepeatable: (msg: import("../index.js").WAMessage, source: string | {
427
+ [x: string]: unknown;
428
+ } | (() => string | {
429
+ [x: string]: unknown;
430
+ } | Promise<string | {
431
+ [x: string]: unknown;
432
+ }>), options?: import("../index.js").RepeatableOptions) => Promise<import("../index.js").WAMessage | undefined>;
433
+ getAdmins: (groupJid: string) => Promise<import("../index.js").GroupParticipant[]>;
434
+ isAdmin: (groupJid: string, who: import("../index.js").GroupMember) => Promise<boolean>;
435
+ isBotAdmin: (groupJid: string) => Promise<boolean>;
436
+ kick: (groupJid: string, who: string | string[]) => Promise<unknown>;
437
+ addMembers: (groupJid: string, who: string | string[]) => Promise<unknown>;
438
+ promote: (groupJid: string, who: string | string[]) => Promise<unknown>;
439
+ demote: (groupJid: string, who: string | string[]) => Promise<unknown>;
440
+ getStats: () => import("../index.js").StatsSnapshot;
441
+ resetStats: () => void;
442
+ getMessageStatus: (message: string | Pick<import("../index.js").WAMessageKey, "id">) => import("../index.js").MessageDelivery | undefined;
443
+ health: ({ ping, timeoutMs }?: {
444
+ ping?: boolean;
445
+ timeoutMs?: number;
446
+ }) => Promise<import("../index.js").HealthReport>;
447
+ queue: {
448
+ readonly size: number;
449
+ clear: () => number;
450
+ };
451
+ }>;
452
+ /** the live socket (changes after a reconnect) */
453
+ readonly sock: ({
454
+ communityMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
455
+ communityCreate: (subject: string, body: string) => Promise<import("../index.js").GroupMetadata | null>;
456
+ communityCreateGroup: (subject: string, participants: string[], parentCommunityJid: string) => Promise<import("../index.js").GroupMetadata | null>;
457
+ communityLeave: (id: string) => Promise<void>;
458
+ communityUpdateSubject: (jid: string, subject: string) => Promise<void>;
459
+ communityLinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
460
+ communityUnlinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
461
+ communityFetchLinkedGroups: (jid: string) => Promise<{
462
+ communityJid: string;
463
+ isCommunity: boolean;
464
+ linkedGroups: {
465
+ id: string | undefined;
466
+ subject: string;
467
+ creation: number | undefined;
468
+ owner: string | undefined;
469
+ size: number | undefined;
470
+ }[];
471
+ }>;
472
+ communityRequestParticipantsList: (jid: string) => Promise<{
473
+ [key: string]: string;
474
+ }[]>;
475
+ communityRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
476
+ status: string;
477
+ jid: string | undefined;
478
+ }[]>;
479
+ communityParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
480
+ status: string;
481
+ jid: string | undefined;
482
+ content: import("../index.js").BinaryNode;
483
+ }[]>;
484
+ communityUpdateDescription: (jid: string, description?: string) => Promise<void>;
485
+ communityInviteCode: (jid: string) => Promise<string | undefined>;
486
+ communityRevokeInvite: (jid: string) => Promise<string | undefined>;
487
+ communityAcceptInvite: (code: string) => Promise<string | undefined>;
488
+ communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>;
489
+ communityAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
490
+ communityGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
491
+ communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
492
+ communitySettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
493
+ communityMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
494
+ communityJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
495
+ communityFetchAllParticipating: () => Promise<{
496
+ [_: string]: import("../index.js").GroupMetadata;
497
+ }>;
498
+ logger: import("../Utils/logger.js").ILogger;
499
+ getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../index.js").OrderDetails>;
500
+ getCatalog: ({ jid, limit, cursor }: import("../index.js").GetCatalogOptions) => Promise<{
501
+ products: import("../index.js").Product[];
502
+ nextPageCursor: string | undefined;
503
+ }>;
504
+ getCollections: (jid?: string, limit?: number) => Promise<{
505
+ collections: import("../index.js").CatalogCollection[];
506
+ }>;
507
+ productCreate: (create: import("../index.js").ProductCreate) => Promise<import("../index.js").Product>;
508
+ productDelete: (productIds: string[]) => Promise<{
509
+ deleted: number;
510
+ }>;
511
+ productUpdate: (productId: string, update: import("../index.js").ProductUpdate) => Promise<import("../index.js").Product>;
512
+ updateBussinesProfile: (args: import("../Types/Bussines.js").UpdateBussinesProfileProps) => Promise<any>;
513
+ updateCoverPhoto: (photo: import("../index.js").WAMediaUpload) => Promise<number>;
514
+ removeCoverPhoto: (id: string) => Promise<any>;
515
+ sendMessageAck: (node: import("../index.js").BinaryNode, errorCode?: number) => Promise<void>;
516
+ sendRetryRequest: (node: import("../index.js").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
517
+ rejectCall: (callId: string, callFrom: string) => Promise<void>;
518
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../index.js").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
519
+ requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, msgData?: Partial<import("../index.js").WAMessage>) => Promise<string | undefined>;
520
+ messageRetryManager: import("../index.js").MessageRetryManager | null;
521
+ userDevicesCache: import("../index.js").PossiblyExtendedCacheStore | import("@cacheable/node-cache").NodeCache<import("../index.js").JidWithDevice[]>;
522
+ devicesMutex: {
523
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
524
+ };
525
+ issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
526
+ assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
527
+ relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../index.js").MessageRelayOptions) => Promise<string>;
528
+ sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
529
+ sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
530
+ readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
531
+ refreshMediaConn: (forceGet?: boolean) => Promise<import("../index.js").MediaConnInfo>;
532
+ getMediaHost: () => string;
533
+ waUploadToServer: import("../index.js").WAMediaUploadFunction;
534
+ fetchPrivacySettings: (force?: boolean) => Promise<{
535
+ [_: string]: string;
536
+ }>;
537
+ sendPeerDataOperationMessage: (pdoMessage: import("../index.js").proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
538
+ createParticipantNodes: (recipientJids: string[], message: import("../index.js").proto.IMessage, extraAttrs?: import("../index.js").BinaryNode["attrs"], dsmMessage?: import("../index.js").proto.IMessage) => Promise<{
539
+ nodes: import("../index.js").BinaryNode[];
540
+ shouldIncludeDeviceIdentity: boolean;
541
+ }>;
542
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<(import("../index.js").JidWithDevice & {
543
+ jid: string;
544
+ })[]>;
545
+ updateMemberLabel: (jid: string, memberLabel: string) => Promise<string>;
546
+ updateMediaMessage: (message: import("../index.js").WAMessage) => Promise<import("../index.js").WAMessage>;
547
+ sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
548
+ newsletterCreate: (name: string, description?: string) => Promise<import("../index.js").NewsletterMetadata>;
549
+ newsletterUpdate: (jid: string, updates: import("../index.js").NewsletterUpdate) => Promise<unknown>;
550
+ newsletterSubscribers: (jid: string) => Promise<{
551
+ subscribers: number;
552
+ }>;
553
+ newsletterMetadata: (type: "invite" | "jid", key: string) => Promise<import("../index.js").NewsletterMetadata | null>;
554
+ newsletterFollow: (jid: string) => Promise<unknown>;
555
+ newsletterUnfollow: (jid: string) => Promise<unknown>;
556
+ newsletterMute: (jid: string) => Promise<unknown>;
557
+ newsletterUnmute: (jid: string) => Promise<unknown>;
558
+ newsletterUpdateName: (jid: string, name: string) => Promise<unknown>;
559
+ newsletterUpdateDescription: (jid: string, description: string) => Promise<unknown>;
560
+ newsletterUpdatePicture: (jid: string, content: import("../index.js").WAMediaUpload) => Promise<unknown>;
561
+ newsletterRemovePicture: (jid: string) => Promise<unknown>;
562
+ newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise<void>;
563
+ newsletterFetchMessages: (jid: string, count: number, since: number, after: number) => Promise<any>;
564
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
565
+ duration: string;
566
+ } | null>;
567
+ newsletterAdminCount: (jid: string) => Promise<number>;
568
+ newsletterChangeOwner: (jid: string, newOwnerJid: string) => Promise<void>;
569
+ newsletterDemote: (jid: string, userJid: string) => Promise<void>;
570
+ newsletterDelete: (jid: string) => Promise<void>;
571
+ groupMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
572
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../index.js").GroupMetadata>;
573
+ groupLeave: (id: string) => Promise<void>;
574
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
575
+ groupRequestParticipantsList: (jid: string) => Promise<{
576
+ [key: string]: string;
577
+ }[]>;
578
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
579
+ status: string;
580
+ jid: string | undefined;
581
+ }[]>;
582
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
583
+ status: string;
584
+ jid: string | undefined;
585
+ content: import("../index.js").BinaryNode;
586
+ }[]>;
587
+ groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
588
+ groupInviteCode: (jid: string) => Promise<string | undefined>;
589
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>;
590
+ groupAcceptInvite: (code: string) => Promise<string | undefined>;
591
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
592
+ groupAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
593
+ groupGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
594
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
595
+ groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
596
+ groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
597
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
598
+ groupFetchAllParticipating: () => Promise<{
599
+ [_: string]: import("../index.js").GroupMetadata;
600
+ }>;
601
+ serverProps: {
602
+ privacyTokenOn1to1: boolean;
603
+ profilePicPrivacyToken: boolean;
604
+ lidTrustedTokenIssueToLid: boolean;
605
+ };
606
+ createCallLink: (type: "audio" | "video", event?: {
607
+ startTime: number;
608
+ }, timeoutMs?: number) => Promise<string | undefined>;
609
+ getBotListV2: () => Promise<import("../index.js").BotListInfo[]>;
610
+ messageMutex: {
611
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
612
+ };
613
+ receiptMutex: {
614
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
615
+ };
616
+ appStatePatchMutex: {
617
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
618
+ };
619
+ notificationMutex: {
620
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
621
+ };
622
+ upsertMessage: (msg: import("../index.js").WAMessage, type: import("../index.js").MessageUpsertType) => Promise<void>;
623
+ appPatch: (patchCreate: import("../index.js").WAPatchCreate) => Promise<void>;
624
+ sendPresenceUpdate: (type: import("../index.js").WAPresence, toJid?: string) => Promise<void>;
625
+ presenceSubscribe: (toJid: string) => Promise<void>;
626
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
627
+ fetchBlocklist: () => Promise<(string | undefined)[]>;
628
+ fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
629
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
630
+ updateProfilePicture: (jid: string, content: import("../index.js").WAMediaUpload, dimensions?: {
631
+ width: number;
632
+ height: number;
633
+ }) => Promise<void>;
634
+ removeProfilePicture: (jid: string) => Promise<void>;
635
+ updateProfileStatus: (status: string) => Promise<void>;
636
+ updateProfileName: (name: string) => Promise<void>;
637
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
638
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
639
+ updateCallPrivacy: (value: import("../index.js").WAPrivacyCallValue) => Promise<void>;
640
+ updateMessagesPrivacy: (value: import("../index.js").WAPrivacyMessagesValue) => Promise<void>;
641
+ updateLastSeenPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
642
+ updateOnlinePrivacy: (value: import("../index.js").WAPrivacyOnlineValue) => Promise<void>;
643
+ updateProfilePicturePrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
644
+ updateStatusPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
645
+ updateReadReceiptsPrivacy: (value: import("../index.js").WAReadReceiptsValue) => Promise<void>;
646
+ updateGroupsAddPrivacy: (value: import("../index.js").WAPrivacyGroupAddValue) => Promise<void>;
647
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>;
648
+ getBusinessProfile: (jid: string) => Promise<import("../index.js").WABusinessProfile | void>;
649
+ resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
650
+ chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise<void>;
651
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
652
+ addOrEditContact: (jid: string, contact: import("../index.js").proto.SyncActionValue.IContactAction) => Promise<void>;
653
+ removeContact: (jid: string) => Promise<void>;
654
+ placeholderResendCache: import("../index.js").CacheStore;
655
+ addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
656
+ addChatLabel: (jid: string, labelId: string) => Promise<void>;
657
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>;
658
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
659
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
660
+ star: (jid: string, messages: {
661
+ id: string;
662
+ fromMe?: boolean;
663
+ }[], star: boolean) => Promise<void>;
664
+ addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
665
+ removeQuickReply: (timestamp: string) => Promise<void>;
666
+ type: "md";
667
+ ws: import("./Client/index.js").WebSocketClient;
668
+ ev: import("../index.js").YuiEventEmitter & {
669
+ process(handler: (events: Partial<import("../index.js").YuiEventMap>) => void | Promise<void>): () => void;
670
+ buffer(): void;
671
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
672
+ flush(): boolean;
673
+ isBuffering(): boolean;
674
+ destroy(): void;
675
+ };
676
+ authState: {
677
+ creds: import("../index.js").AuthenticationCreds;
678
+ keys: import("../index.js").SignalKeyStoreWithTransaction;
679
+ };
680
+ signalRepository: import("../index.js").SignalRepositoryWithLIDStore;
681
+ user: import("../index.js").Contact | undefined;
682
+ generateMessageTag: () => string;
683
+ query: (node: import("../index.js").BinaryNode, timeoutMs?: number) => Promise<any>;
684
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
685
+ waitForSocketOpen: () => Promise<void>;
686
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
687
+ sendNode: (frame: import("../index.js").BinaryNode) => Promise<void>;
688
+ logout: (msg?: string) => Promise<void>;
689
+ end: (error: Error | undefined) => Promise<void>;
690
+ registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
691
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
692
+ uploadPreKeys: (count?: number) => Promise<void>;
693
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
694
+ digestKeyBundle: () => Promise<void>;
695
+ rotateSignedPreKey: () => Promise<void>;
696
+ requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
697
+ updateServerTimeOffset: ({ attrs }: import("../index.js").BinaryNode) => void;
698
+ sendUnifiedSession: () => Promise<void>;
699
+ wamBuffer: import("../index.js").BinaryInfo;
700
+ waitForConnectionUpdate: (check: (u: Partial<import("../index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
701
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
702
+ executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
703
+ onWhatsApp: (...phoneNumber: string[]) => Promise<{
704
+ jid: string;
705
+ exists: boolean;
706
+ }[] | undefined>;
707
+ fetchAccountReachoutTimelock: () => Promise<import("../index.js").ReachoutTimelockState>;
708
+ fetchNewChatMessageCap: () => Promise<import("../index.js").NewChatMessageCapInfo>;
709
+ } & {
710
+ getSender: (msg: import("../index.js").WAMessage) => Promise<import("../index.js").SenderInfo>;
711
+ reply: (msg: import("../index.js").WAMessage, content: string | {
712
+ [x: string]: unknown;
713
+ }, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
714
+ react: (msg: import("../index.js").WAMessage, emoji: string) => Promise<import("../index.js").WAMessage | undefined>;
715
+ sendSafe: (jid: string, content: string | {
716
+ [x: string]: unknown;
717
+ }, options?: import("../index.js").MiscMessageGenerationOptions, { timeoutMs }?: import("../index.js").SendSafeOptions) => Promise<import("../index.js").SendResult>;
718
+ sendButtons: (jid: string, { buttons, ...rest }: import("../index.js").SendButtonsOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
719
+ sendCarousel: (jid: string, { cards, ...rest }: import("../index.js").SendCarouselOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
720
+ disableButtons: (msg: import("../index.js").WAMessage, text?: string) => Promise<boolean>;
721
+ sendList: (jid: string, { sections, ...rest }: import("../index.js").SendListOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
722
+ sendPoll: (jid: string, name: string, values: string[], poll?: Partial<Omit<import("../index.js").PollMessageOptions, "name" | "values">>, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
723
+ sendQuiz: (jid: string, name: string, values: string[], correctAnswer: string | number, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
724
+ getPollVotes: (pollKey: import("../index.js").WAMessageKey | string) => {
725
+ pollKey: import("../index.js").WAMessageKey;
726
+ pollName: string;
727
+ votes: {
728
+ name: string;
729
+ voters: string[];
730
+ }[];
731
+ } | undefined;
732
+ getQuizResult: (pollKey: import("../index.js").WAMessageKey | string) => {
733
+ pollKey: import("../index.js").WAMessageKey;
734
+ pollName: string;
735
+ correct: string;
736
+ right: string[];
737
+ wrong: string[];
738
+ votes: {
739
+ name: string;
740
+ voters: string[];
741
+ }[];
742
+ } | undefined;
743
+ downloadMedia: (msg: import("../index.js").WAMessage, options?: import("../index.js").DownloadMediaOptions) => Promise<Buffer>;
744
+ } & {
745
+ onReply: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
746
+ onButton: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
747
+ onList: (matcher: import("../index.js").ReplyMatcher, run: import("../index.js").ReplyHandler, options?: import("../index.js").OnReplyOptions) => () => boolean;
748
+ awaitReply: (msg: import("../index.js").WAMessage, { timeoutMs, filter }?: import("../index.js").AwaitReplyOptions) => Promise<import("../index.js").WAMessage | undefined>;
749
+ } & {
750
+ commands: {
751
+ add: (definition: import("../index.js").CommandDefinition) => /*elided*/ any;
752
+ remove: (name: string) => boolean;
753
+ get: (name: string) => import("../index.js").CommandDefinition | undefined;
754
+ list: () => import("../index.js").CommandDefinition[];
755
+ cooldowns: {
756
+ use: (user: string, action: string, ms: number) => number;
757
+ left: (user: string, action: string) => number;
758
+ reset: (user: string, action?: string) => void;
759
+ clear: () => void;
760
+ };
761
+ handle: (msg: import("../index.js").WAMessage) => Promise<boolean>;
762
+ listen: () => () => void | undefined;
763
+ };
764
+ schedule: {
765
+ at: (when: Date | number | string, jid: string, content: {
766
+ [x: string]: unknown;
767
+ }) => string;
768
+ after: (delay: string | number, jid: string, content: {
769
+ [x: string]: unknown;
770
+ }) => string;
771
+ every: (interval: string | number, jid: string, content: {
772
+ [x: string]: unknown;
773
+ }, extra?: {
774
+ times?: number;
775
+ }) => string;
776
+ cron: (expression: string, jid: string, content: {
777
+ [x: string]: unknown;
778
+ }, extra?: {
779
+ times?: number;
780
+ }) => string;
781
+ list: () => import("../index.js").ScheduledJob[];
782
+ cancel: (id: string) => boolean;
783
+ clear: () => void;
784
+ start: () => void;
785
+ stop: () => void;
786
+ flush: () => Promise<void>;
787
+ };
788
+ cooldown: (user: string, action: string, ms: number) => number;
789
+ sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
790
+ sendMessageNow: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
791
+ messageStore: {
792
+ save: (msg: Pick<import("../index.js").WAMessage, "key" | "message"> | null | undefined) => void;
793
+ get: (key: Pick<import("../index.js").WAMessageKey, "id">) => import("../index.js").proto.IMessage | undefined;
794
+ readonly size: number;
795
+ clear: () => void;
796
+ } | undefined;
797
+ groupCache: {
798
+ get: (jid: string) => import("../index.js").GroupMetadata | undefined;
799
+ set: (jid: string, data: import("../index.js").GroupMetadata) => void;
800
+ delete: (jid: string) => boolean;
801
+ clear: () => void;
802
+ readonly size: number;
803
+ } | undefined;
804
+ sendContact: (jid: string, contacts: import("../index.js").ContactInput | import("../index.js").ContactInput[] | string, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
805
+ sendLocation: (jid: string, { latitude, longitude, name, address }: import("../index.js").LocationInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
806
+ sendAlbum: (jid: string, items: import("../index.js").AlbumItem[], options?: import("../index.js").MiscMessageGenerationOptions) => Promise<{
807
+ album: import("../index.js").WAMessage;
808
+ items: (import("../index.js").WAMessage | undefined)[];
809
+ }>;
810
+ sendEvent: (jid: string, event: import("../index.js").EventInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
811
+ sendLong: (jid: string, text: string, long?: import("../index.js").SendLongOptions, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<(import("../index.js").WAMessage | undefined)[]>;
812
+ sendImagePoll: (jid: string, poll: import("../index.js").ImagePollInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<{
813
+ album: {
814
+ album: import("../index.js").WAMessage;
815
+ items: (import("../index.js").WAMessage | undefined)[];
816
+ };
817
+ poll: import("../index.js").WAMessage | undefined;
818
+ }>;
819
+ sendScheduledCall: (jid: string, call: import("../index.js").ScheduledCallInput, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
820
+ sendStatusMention: (content: Record<string, any>, { mentions, backgroundColor, font }: import("../index.js").StatusMentionOptions) => Promise<import("../index.js").WAMessage>;
821
+ ask: (to: import("../index.js").WAMessage, question: string, { timeoutMs }?: import("../index.js").AskOptions) => Promise<string | undefined>;
822
+ confirm: (msg: import("../index.js").WAMessage, text: string, options?: import("../index.js").ConfirmOptions) => Promise<boolean>;
823
+ paginate: (msg: import("../index.js").WAMessage, items: unknown[], options?: import("../index.js").PaginateOptions) => Promise<import("../index.js").WAMessage | undefined>;
824
+ menu: (msg: import("../index.js").WAMessage, definition: import("../index.js").MenuDefinition) => Promise<import("../index.js").WAMessage | undefined>;
825
+ sendGuardedButtons: (msg: import("../index.js").WAMessage, options: import("../index.js").GuardedButtonsOptions, onTap: (tap: import("../index.js").TapContext & {
826
+ id: string;
827
+ }) => void | Promise<void>) => Promise<import("../index.js").WAMessage | undefined>;
828
+ sendRepeatable: (msg: import("../index.js").WAMessage, source: string | {
829
+ [x: string]: unknown;
830
+ } | (() => string | {
831
+ [x: string]: unknown;
832
+ } | Promise<string | {
833
+ [x: string]: unknown;
834
+ }>), options?: import("../index.js").RepeatableOptions) => Promise<import("../index.js").WAMessage | undefined>;
835
+ getAdmins: (groupJid: string) => Promise<import("../index.js").GroupParticipant[]>;
836
+ isAdmin: (groupJid: string, who: import("../index.js").GroupMember) => Promise<boolean>;
837
+ isBotAdmin: (groupJid: string) => Promise<boolean>;
838
+ kick: (groupJid: string, who: string | string[]) => Promise<unknown>;
839
+ addMembers: (groupJid: string, who: string | string[]) => Promise<unknown>;
840
+ promote: (groupJid: string, who: string | string[]) => Promise<unknown>;
841
+ demote: (groupJid: string, who: string | string[]) => Promise<unknown>;
842
+ getStats: () => import("../index.js").StatsSnapshot;
843
+ resetStats: () => void;
844
+ getMessageStatus: (message: string | Pick<import("../index.js").WAMessageKey, "id">) => import("../index.js").MessageDelivery | undefined;
845
+ health: ({ ping, timeoutMs }?: {
846
+ ping?: boolean;
847
+ timeoutMs?: number;
848
+ }) => Promise<import("../index.js").HealthReport>;
849
+ queue: {
850
+ readonly size: number;
851
+ clear: () => number;
852
+ };
853
+ }) | undefined;
854
+ /** closes the connection but keeps the login */
855
+ stop: () => Promise<boolean>;
856
+ /** logs out of WhatsApp and deletes the saved login */
857
+ logout: () => Promise<boolean>;
858
+ }>;
859
+ export type Bot = Awaited<ReturnType<typeof connectBot>>;
860
+ //# sourceMappingURL=connect-bot.d.ts.map