lordceaser-baileys 2.0.12 → 2.0.13
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.
- package/package.json +1 -1
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/index.d.ts +0 -284
- package/lib/Defaults/index.js +0 -121
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/libsignal.d.ts +0 -4
- package/lib/Signal/libsignal.js +0 -162
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/index.d.ts +0 -2
- package/lib/Socket/Client/index.js +0 -22
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/types.d.ts +0 -16
- package/lib/Socket/Client/types.js +0 -18
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/Client/websocket.js +0 -62
- package/lib/Socket/business.d.ts +0 -182
- package/lib/Socket/business.js +0 -268
- package/lib/Socket/chats.d.ts +0 -96
- package/lib/Socket/chats.js +0 -1026
- package/lib/Socket/groups.d.ts +0 -130
- package/lib/Socket/groups.js +0 -338
- package/lib/Socket/index.d.ts +0 -185
- package/lib/Socket/index.js +0 -14
- package/lib/Socket/messages-recv.d.ts +0 -171
- package/lib/Socket/messages-recv.js +0 -1182
- package/lib/Socket/messages-send.d.ts +0 -162
- package/lib/Socket/messages-send.js +0 -1006
- package/lib/Socket/newsletter.d.ts +0 -142
- package/lib/Socket/newsletter.js +0 -256
- package/lib/Socket/registration.d.ts +0 -264
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/socket.d.ts +0 -45
- package/lib/Socket/socket.js +0 -751
- package/lib/Socket/socket.js.bak +0 -751
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.js +0 -24
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -90
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-in-memory-store.js +0 -429
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/make-ordered-dictionary.js +0 -86
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -31
- package/lib/Types/Auth.d.ts +0 -120
- package/lib/Types/Auth.js +0 -3
- package/lib/Types/Call.d.ts +0 -14
- package/lib/Types/Call.js +0 -3
- package/lib/Types/Chat.d.ts +0 -134
- package/lib/Types/Chat.js +0 -9
- package/lib/Types/Contact.d.ts +0 -25
- package/lib/Types/Contact.js +0 -3
- package/lib/Types/Events.d.ts +0 -212
- package/lib/Types/Events.js +0 -3
- package/lib/Types/GroupMetadata.d.ts +0 -64
- package/lib/Types/GroupMetadata.js +0 -3
- package/lib/Types/Label.d.ts +0 -48
- package/lib/Types/Label.js +0 -31
- package/lib/Types/LabelAssociation.d.ts +0 -35
- package/lib/Types/LabelAssociation.js +0 -13
- package/lib/Types/Message.d.ts +0 -459
- package/lib/Types/Message.js +0 -13
- package/lib/Types/Newsletter.d.ts +0 -107
- package/lib/Types/Newsletter.js +0 -38
- package/lib/Types/Product.d.ts +0 -92
- package/lib/Types/Product.js +0 -3
- package/lib/Types/Signal.d.ts +0 -68
- package/lib/Types/Signal.js +0 -3
- package/lib/Types/Socket.d.ts +0 -120
- package/lib/Types/Socket.js +0 -3
- package/lib/Types/State.d.ts +0 -29
- package/lib/Types/State.js +0 -3
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/USync.js +0 -3
- package/lib/Types/index.d.ts +0 -78
- package/lib/Types/index.js +0 -47
- package/lib/Utils/auth-utils.d.ts +0 -21
- package/lib/Utils/auth-utils.js +0 -205
- package/lib/Utils/baileys-event-stream.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.js +0 -70
- package/lib/Utils/business.d.ts +0 -29
- package/lib/Utils/business.js +0 -247
- package/lib/Utils/chat-utils.d.ts +0 -82
- package/lib/Utils/chat-utils.js +0 -774
- package/lib/Utils/crypto.d.ts +0 -56
- package/lib/Utils/crypto.js +0 -179
- package/lib/Utils/decode-wa-message.d.ts +0 -41
- package/lib/Utils/decode-wa-message.js +0 -236
- package/lib/Utils/event-buffer.d.ts +0 -39
- package/lib/Utils/event-buffer.js +0 -548
- package/lib/Utils/generics.d.ts +0 -129
- package/lib/Utils/generics.js +0 -485
- package/lib/Utils/history.d.ts +0 -23
- package/lib/Utils/history.js +0 -100
- package/lib/Utils/index.d.ts +0 -20
- package/lib/Utils/index.js +0 -40
- package/lib/Utils/link-preview.d.ts +0 -23
- package/lib/Utils/link-preview.js +0 -120
- package/lib/Utils/logger.d.ts +0 -13
- package/lib/Utils/logger.js +0 -7
- package/lib/Utils/lt-hash.d.ts +0 -14
- package/lib/Utils/lt-hash.js +0 -58
- package/lib/Utils/make-mutex.d.ts +0 -9
- package/lib/Utils/make-mutex.js +0 -49
- package/lib/Utils/messages-media.d.ts +0 -129
- package/lib/Utils/messages-media.js +0 -782
- package/lib/Utils/messages.d.ts +0 -103
- package/lib/Utils/messages.js +0 -1631
- package/lib/Utils/noise-handler.d.ts +0 -20
- package/lib/Utils/noise-handler.js +0 -155
- package/lib/Utils/process-message.d.ts +0 -49
- package/lib/Utils/process-message.js +0 -387
- package/lib/Utils/signal.d.ts +0 -42
- package/lib/Utils/signal.js +0 -166
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-multi-file-auth-state.js +0 -131
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/Utils/use-sql-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-sql-file-auth-state.js +0 -143
- package/lib/Utils/validate-connection.d.ts +0 -13
- package/lib/Utils/validate-connection.js +0 -186
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/constants.js +0 -53
- package/lib/WABinary/decode.d.ts +0 -9
- package/lib/WABinary/decode.js +0 -288
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/encode.js +0 -256
- package/lib/WABinary/generic-utils.d.ts +0 -28
- package/lib/WABinary/generic-utils.js +0 -150
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/index.js +0 -25
- package/lib/WABinary/jid-utils.d.ts +0 -53
- package/lib/WABinary/jid-utils.js +0 -92
- package/lib/WABinary/types.d.ts +0 -22
- package/lib/WABinary/types.js +0 -3
- package/lib/WAM/BinaryInfo.d.ts +0 -16
- package/lib/WAM/BinaryInfo.js +0 -17
- package/lib/WAM/constants.d.ts +0 -47
- package/lib/WAM/constants.js +0 -15371
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/encode.js +0 -165
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAM/index.js +0 -23
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -69
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -36
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -62
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -35
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -30
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -46
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/Protocols/index.js +0 -26
- package/lib/WAUSync/USyncQuery.d.ts +0 -31
- package/lib/WAUSync/USyncQuery.js +0 -92
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/USyncUser.js +0 -30
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/WAUSync/index.js +0 -23
- package/lib/index.d.ts +0 -13
- package/lib/index.js +0 -33
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { SocketConfig, WAMediaUpload, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, NewsletterFetchedUpdate, ContactAction } from '../Types'
|
|
2
|
-
import { BinaryNode } from '../WABinary'
|
|
3
|
-
|
|
4
|
-
export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
5
|
-
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
6
|
-
duration: string
|
|
7
|
-
}>
|
|
8
|
-
newsletterReactionMode: (jid: string, mode: NewsletterReactionMode) => Promise<void>
|
|
9
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>
|
|
10
|
-
newsletterUpdateName: (jid: string, name: string) => Promise<void>
|
|
11
|
-
newsletterUpdatePicture: (jid: string, content: WAMediaUpload) => Promise<void>
|
|
12
|
-
newsletterRemovePicture: (jid: string) => Promise<void>
|
|
13
|
-
newsletterUnfollow: (jid: string) => Promise<void>
|
|
14
|
-
newsletterFollow: (jid: string) => Promise<void>
|
|
15
|
-
newsletterUnmute: (jid: string) => Promise<void>
|
|
16
|
-
newsletterMute: (jid: string) => Promise<void>
|
|
17
|
-
newsletterCreate: (name: string, description: string) => Promise<NewsletterMetadata>
|
|
18
|
-
newsletterQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
|
|
19
|
-
newsletterWMexQuery: (jid?: string | undefined, query_id: number, content: BinaryNode) => Promise<BinaryNode>
|
|
20
|
-
newsletterMetadata: (type: 'invite' | 'jid', key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>
|
|
21
|
-
newsletterAdminCount: (jid: string) => Promise<number>
|
|
22
|
-
newsletterChangeOwner: (jid: string, userLid: string) => Promise<void>
|
|
23
|
-
newsletterDemote: (jid: string, userLid: string) => Promise<void>
|
|
24
|
-
newsletterDelete: (jid: string) => Promise<void>
|
|
25
|
-
/**if code wasn't passed, the reaction will be removed (if is reacted) */
|
|
26
|
-
newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>
|
|
27
|
-
newsletterFetchMessages: (type: 'invite' | 'jid', key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>
|
|
28
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<NewsletterFetchedUpdate[]>
|
|
29
|
-
groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
|
|
30
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>
|
|
31
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>
|
|
32
|
-
groupLeave: (id: string) => Promise<void>
|
|
33
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>
|
|
34
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
35
|
-
[key: string]: string
|
|
36
|
-
}[]>
|
|
37
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
38
|
-
status: string
|
|
39
|
-
jid: string
|
|
40
|
-
}[]>
|
|
41
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
42
|
-
status: string
|
|
43
|
-
jid: string
|
|
44
|
-
content: BinaryNode
|
|
45
|
-
}[]>
|
|
46
|
-
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
|
|
47
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>
|
|
48
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>
|
|
49
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>
|
|
50
|
-
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
|
|
51
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>
|
|
52
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>
|
|
53
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
|
|
54
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>
|
|
55
|
-
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>
|
|
56
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>
|
|
57
|
-
groupFetchAllParticipating: () => Promise<{
|
|
58
|
-
[_: string]: import("../Types").GroupMetadata
|
|
59
|
-
}>
|
|
60
|
-
processingMutex: {
|
|
61
|
-
mutex<T>(code: () => T | Promise<T>): Promise<T>
|
|
62
|
-
}
|
|
63
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
64
|
-
[_: string]: string
|
|
65
|
-
}>
|
|
66
|
-
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
|
|
67
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
|
|
68
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
|
|
69
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
|
|
70
|
-
getBotListV2: () => Promise<BotListInfo[]>
|
|
71
|
-
getLidUser: (jid: string) => Promise<{
|
|
72
|
-
lid: string
|
|
73
|
-
id: string
|
|
74
|
-
}[] | undefined>
|
|
75
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
76
|
-
jid: string
|
|
77
|
-
exists: unknown
|
|
78
|
-
}[] | undefined>
|
|
79
|
-
fetchBlocklist: () => Promise<string[]>
|
|
80
|
-
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>
|
|
81
|
-
fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>
|
|
82
|
-
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>
|
|
83
|
-
removeProfilePicture: (jid: string) => Promise<void>
|
|
84
|
-
updateProfileStatus: (status: string) => Promise<void>
|
|
85
|
-
updateProfileName: (name: string) => Promise<void>
|
|
86
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
|
|
87
|
-
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
|
|
88
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
89
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
|
|
90
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
91
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
92
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
|
|
93
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
|
|
94
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>
|
|
95
|
-
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
|
|
96
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
|
|
97
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
|
|
98
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
|
|
99
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
100
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
101
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
102
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
103
|
-
clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
|
|
104
|
-
star: (jid: string, messages: {
|
|
105
|
-
id: string
|
|
106
|
-
fromMe?: boolean | undefined
|
|
107
|
-
}[], star: boolean) => Promise<void>
|
|
108
|
-
addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
|
|
109
|
-
removeContact: (jid: string) => Promise<void>
|
|
110
|
-
executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>
|
|
111
|
-
type: "md"
|
|
112
|
-
ws: any
|
|
113
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
114
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
|
|
115
|
-
buffer(): void
|
|
116
|
-
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
|
|
117
|
-
flush(force?: boolean | undefined): boolean
|
|
118
|
-
isBuffering(): boolean
|
|
119
|
-
}
|
|
120
|
-
authState: {
|
|
121
|
-
creds: import("../Types").AuthenticationCreds
|
|
122
|
-
keys: import("../Types").SignalKeyStoreWithTransaction
|
|
123
|
-
}
|
|
124
|
-
signalRepository: import("../Types").SignalRepository
|
|
125
|
-
user: import("../Types").Contact | undefined
|
|
126
|
-
generateMessageTag: () => string
|
|
127
|
-
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
|
|
128
|
-
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
|
|
129
|
-
waitForSocketOpen: () => Promise<void>
|
|
130
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
|
|
131
|
-
sendNode: (frame: BinaryNode) => Promise<void>
|
|
132
|
-
logout: (msg?: string | undefined) => Promise<void>
|
|
133
|
-
end: (error: Error | undefined) => void
|
|
134
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
|
|
135
|
-
uploadPreKeys: (count?: number) => Promise<void>
|
|
136
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>
|
|
137
|
-
requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
|
|
138
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
|
|
139
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export declare const extractNewsletterMetadata: (node: BinaryNode, isCreate?: boolean) => NewsletterMetadata
|
package/lib/Socket/newsletter.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
-
|
|
5
|
-
const Types_1 = require("../Types")
|
|
6
|
-
const Utils_1 = require("../Utils")
|
|
7
|
-
const WABinary_1 = require("../WABinary")
|
|
8
|
-
const groups_1 = require("./groups")
|
|
9
|
-
|
|
10
|
-
const makeNewsletterSocket = (config) => {
|
|
11
|
-
const slips = groups_1.makeGroupsSocket(config)
|
|
12
|
-
const { authState, signalRepository, query, generateMessageTag } = slips
|
|
13
|
-
const encoder = new TextEncoder()
|
|
14
|
-
|
|
15
|
-
const newsletterQuery = async (jid, type, content) => (query({
|
|
16
|
-
tag: 'iq',
|
|
17
|
-
attrs: {
|
|
18
|
-
id: generateMessageTag(),
|
|
19
|
-
type,
|
|
20
|
-
xmlns: 'newsletter',
|
|
21
|
-
to: jid,
|
|
22
|
-
},
|
|
23
|
-
content
|
|
24
|
-
}))
|
|
25
|
-
|
|
26
|
-
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
27
|
-
tag: 'iq',
|
|
28
|
-
attrs: {
|
|
29
|
-
id: generateMessageTag(),
|
|
30
|
-
type: 'get',
|
|
31
|
-
xmlns: 'w:mex',
|
|
32
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
33
|
-
},
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
tag: 'query',
|
|
37
|
-
attrs: { 'query_id': queryId },
|
|
38
|
-
content: encoder.encode(JSON.stringify({
|
|
39
|
-
variables: {
|
|
40
|
-
'newsletter_id': jid,
|
|
41
|
-
...content
|
|
42
|
-
}
|
|
43
|
-
}))
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}))
|
|
47
|
-
|
|
48
|
-
const parseFetchedUpdates = async (node, type) => {
|
|
49
|
-
let child
|
|
50
|
-
if (type === 'messages') {
|
|
51
|
-
child = WABinary_1.getBinaryNodeChild(node, 'messages')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
else {
|
|
55
|
-
const parent = WABinary_1.getBinaryNodeChild(node, 'message_updates')
|
|
56
|
-
child = WABinary_1.getBinaryNodeChild(parent, 'messages')
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return await Promise.all(WABinary_1.getAllBinaryNodeChildren(child).map(async (messageNode) => {
|
|
60
|
-
messageNode.attrs.from = child?.attrs.jid
|
|
61
|
-
|
|
62
|
-
const views = parseInt(WABinary_1.getBinaryNodeChild(messageNode, 'views_count')?.attrs?.count || '0')
|
|
63
|
-
const reactionNode = WABinary_1.getBinaryNodeChild(messageNode, 'reactions')
|
|
64
|
-
const reactions = WABinary_1.getBinaryNodeChildren(reactionNode, 'reaction')
|
|
65
|
-
.map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }))
|
|
66
|
-
|
|
67
|
-
const data = {
|
|
68
|
-
'server_id': messageNode.attrs.server_id,
|
|
69
|
-
views,
|
|
70
|
-
reactions
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (type === 'messages') {
|
|
74
|
-
const { fullMessage: message, decrypt } = await Utils_1.decryptMessageNode(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger)
|
|
75
|
-
await decrypt()
|
|
76
|
-
data.message = message
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return data
|
|
80
|
-
}))
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
...slips,
|
|
85
|
-
newsletterQuery,
|
|
86
|
-
newsletterWMexQuery,
|
|
87
|
-
subscribeNewsletterUpdates: async (jid) => {
|
|
88
|
-
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }])
|
|
89
|
-
|
|
90
|
-
return WABinary_1.getBinaryNodeChild(result, 'live_updates')?.attrs
|
|
91
|
-
},
|
|
92
|
-
newsletterReactionMode: async (jid, mode) => {
|
|
93
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
94
|
-
updates: { settings: { 'reaction_codes': { value: mode } } }
|
|
95
|
-
})
|
|
96
|
-
},
|
|
97
|
-
newsletterUpdateDescription: async (jid, description) => {
|
|
98
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
99
|
-
updates: { description: description || '', settings: null }
|
|
100
|
-
})
|
|
101
|
-
},
|
|
102
|
-
newsletterUpdateName: async (jid, name) => {
|
|
103
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
104
|
-
updates: { name, settings: null }
|
|
105
|
-
})
|
|
106
|
-
},
|
|
107
|
-
newsletterUpdatePicture: async (jid, content) => {
|
|
108
|
-
const { img } = await Utils_1.generateProfilePicture(content)
|
|
109
|
-
|
|
110
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
111
|
-
updates: { picture: img.toString('base64'), settings: null }
|
|
112
|
-
})
|
|
113
|
-
},
|
|
114
|
-
newsletterRemovePicture: async (jid) => {
|
|
115
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
116
|
-
updates: { picture: '', settings: null }
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
newsletterUnfollow: async (jid) => {
|
|
120
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW)
|
|
121
|
-
},
|
|
122
|
-
newsletterFollow: async (jid) => {
|
|
123
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW)
|
|
124
|
-
},
|
|
125
|
-
newsletterUnmute: async (jid) => {
|
|
126
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE)
|
|
127
|
-
},
|
|
128
|
-
newsletterMute: async (jid) => {
|
|
129
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE)
|
|
130
|
-
},
|
|
131
|
-
newsletterAction: async (jid, type) => {
|
|
132
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds[type.toUpperCase()])
|
|
133
|
-
},
|
|
134
|
-
newsletterCreate: async (name, description) => {
|
|
135
|
-
//TODO: Implement TOS system wide for Meta AI, communities, and here etc.
|
|
136
|
-
/**tos query */
|
|
137
|
-
await query({
|
|
138
|
-
tag: 'iq',
|
|
139
|
-
attrs: {
|
|
140
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
141
|
-
xmlns: 'tos',
|
|
142
|
-
id: generateMessageTag(),
|
|
143
|
-
type: 'set'
|
|
144
|
-
},
|
|
145
|
-
content: [
|
|
146
|
-
{
|
|
147
|
-
tag: 'notice',
|
|
148
|
-
attrs: {
|
|
149
|
-
id: '20601218',
|
|
150
|
-
stage: '5'
|
|
151
|
-
},
|
|
152
|
-
content: []
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
|
158
|
-
input: { name, description, settings: null }
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
return extractNewsletterMetadata(result, true)
|
|
162
|
-
},
|
|
163
|
-
newsletterMetadata: async (type, key, role) => {
|
|
164
|
-
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
165
|
-
input: {
|
|
166
|
-
key,
|
|
167
|
-
type: type.toUpperCase(),
|
|
168
|
-
view_role: role || 'GUEST'
|
|
169
|
-
},
|
|
170
|
-
fetch_viewer_metadata: true,
|
|
171
|
-
fetch_full_image: true,
|
|
172
|
-
fetch_creation_time: true
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
return extractNewsletterMetadata(result)
|
|
176
|
-
},
|
|
177
|
-
newsletterAdminCount: async (jid) => {
|
|
178
|
-
const result = await newsletterWMexQuery(jid, QueryIds.ADMIN_COUNT)
|
|
179
|
-
const buff = WABinary_1.getBinaryNodeChild(result, 'result')?.content?.toString()
|
|
180
|
-
|
|
181
|
-
return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count
|
|
182
|
-
},
|
|
183
|
-
newsletterChangeOwner: async (jid, userLid) => {
|
|
184
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
|
|
185
|
-
user_id: userLid
|
|
186
|
-
})
|
|
187
|
-
},
|
|
188
|
-
newsletterDemote: async (jid, userLid) => {
|
|
189
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
|
|
190
|
-
user_id: userLid
|
|
191
|
-
})
|
|
192
|
-
},
|
|
193
|
-
newsletterDelete: async (jid) => {
|
|
194
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE)
|
|
195
|
-
},
|
|
196
|
-
/**if code wasn't passed, the reaction will be removed (if is reacted) */
|
|
197
|
-
newsletterReactMessage: async (jid, serverId, code) => {
|
|
198
|
-
await query({
|
|
199
|
-
tag: 'message',
|
|
200
|
-
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', server_id: serverId, id: Utils_1.generateMessageID() },
|
|
201
|
-
content: [{
|
|
202
|
-
tag: 'reaction',
|
|
203
|
-
attrs: code ? { code } : {}
|
|
204
|
-
}]
|
|
205
|
-
})
|
|
206
|
-
},
|
|
207
|
-
newsletterFetchMessages: async (type, key, count, after) => {
|
|
208
|
-
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
|
|
209
|
-
{
|
|
210
|
-
tag: 'messages',
|
|
211
|
-
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: after?.toString() || '100' }
|
|
212
|
-
}
|
|
213
|
-
])
|
|
214
|
-
|
|
215
|
-
return await parseFetchedUpdates(result, 'messages')
|
|
216
|
-
},
|
|
217
|
-
newsletterFetchUpdates: async (jid, count, after, since) => {
|
|
218
|
-
const result = await newsletterQuery(jid, 'get', [
|
|
219
|
-
{
|
|
220
|
-
tag: 'message_updates',
|
|
221
|
-
attrs: { count: count.toString(), after: after?.toString() || '100', since: since?.toString() || '0' }
|
|
222
|
-
}
|
|
223
|
-
])
|
|
224
|
-
|
|
225
|
-
return await parseFetchedUpdates(result, 'updates')
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const extractNewsletterMetadata = (node, isCreate) => {
|
|
231
|
-
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString()
|
|
232
|
-
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER]
|
|
233
|
-
|
|
234
|
-
const metadata = {
|
|
235
|
-
id: metadataPath.id,
|
|
236
|
-
state: metadataPath.state.type,
|
|
237
|
-
creation_time: +metadataPath.thread_metadata.creation_time,
|
|
238
|
-
name: metadataPath.thread_metadata.name.text,
|
|
239
|
-
nameTime: +metadataPath.thread_metadata.name.update_time,
|
|
240
|
-
description: metadataPath.thread_metadata.description.text,
|
|
241
|
-
descriptionTime: +metadataPath.thread_metadata.description.update_time,
|
|
242
|
-
invite: metadataPath.thread_metadata.invite,
|
|
243
|
-
handle: metadataPath.thread_metadata.handle,
|
|
244
|
-
picture: Utils_1.getUrlFromDirectPath(metadataPath.thread_metadata.picture?.direct_path || ''),
|
|
245
|
-
preview: Utils_1.getUrlFromDirectPath(metadataPath.thread_metadata.preview?.direct_path || ''),
|
|
246
|
-
reaction_codes: metadataPath.thread_metadata.settings.reaction_codes.value,
|
|
247
|
-
subscribers: +metadataPath.thread_metadata.subscribers_count,
|
|
248
|
-
verification: metadataPath.thread_metadata.verification,
|
|
249
|
-
viewer_metadata: metadataPath.viewer_metadata
|
|
250
|
-
}
|
|
251
|
-
return metadata
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
module.exports = {
|
|
255
|
-
makeNewsletterSocket
|
|
256
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
|
3
|
-
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
4
|
-
register: (code: string) => Promise<ExistsResponse>;
|
|
5
|
-
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
|
6
|
-
logger: Logger;
|
|
7
|
-
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
|
-
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
9
|
-
products: import("../Types").Product[];
|
|
10
|
-
nextPageCursor: any;
|
|
11
|
-
}>;
|
|
12
|
-
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
13
|
-
collections: import("../Types").CatalogCollection[];
|
|
14
|
-
}>;
|
|
15
|
-
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
16
|
-
productDelete: (productIds: string[]) => Promise<{
|
|
17
|
-
deleted: number;
|
|
18
|
-
}>;
|
|
19
|
-
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
20
|
-
sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode, errorCode?: number) => Promise<void>;
|
|
21
|
-
sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
22
|
-
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
23
|
-
id: any;
|
|
24
|
-
to: string;
|
|
25
|
-
}>;
|
|
26
|
-
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
27
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
28
|
-
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
29
|
-
getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
|
|
30
|
-
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
31
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
32
|
-
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
33
|
-
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
34
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("../WABinary").BinaryNode["attrs"];
|
|
35
|
-
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
36
|
-
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
37
|
-
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
38
|
-
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
39
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("../WABinary").BinaryNode["attrs"]) => Promise<{
|
|
40
|
-
nodes: import("../WABinary").BinaryNode[];
|
|
41
|
-
shouldIncludeDeviceIdentity: boolean;
|
|
42
|
-
}>;
|
|
43
|
-
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
44
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
45
|
-
[_: string]: string;
|
|
46
|
-
}>;
|
|
47
|
-
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
48
|
-
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
49
|
-
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
50
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
51
|
-
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
52
|
-
duration: string;
|
|
53
|
-
}>;
|
|
54
|
-
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
55
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
56
|
-
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
57
|
-
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
58
|
-
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
59
|
-
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
60
|
-
newsletterFollow: (jid: string) => Promise<void>;
|
|
61
|
-
newsletterUnmute: (jid: string) => Promise<void>;
|
|
62
|
-
newsletterMute: (jid: string) => Promise<void>;
|
|
63
|
-
newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
|
|
64
|
-
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
65
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
66
|
-
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
67
|
-
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
68
|
-
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
69
|
-
newsletterDelete: (jid: string) => Promise<void>;
|
|
70
|
-
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
71
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
72
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
73
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
74
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
75
|
-
groupLeave: (id: string) => Promise<void>;
|
|
76
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
77
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
78
|
-
[key: string]: string;
|
|
79
|
-
}[]>;
|
|
80
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
81
|
-
status: string;
|
|
82
|
-
jid: string;
|
|
83
|
-
}[]>;
|
|
84
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
85
|
-
status: string;
|
|
86
|
-
jid: string;
|
|
87
|
-
content: import("../WABinary").BinaryNode;
|
|
88
|
-
}[]>;
|
|
89
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
90
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
91
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
92
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
93
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
94
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
95
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
96
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
97
|
-
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
98
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
99
|
-
groupFetchAllParticipating: () => Promise<{
|
|
100
|
-
[_: string]: import("../Types").GroupMetadata;
|
|
101
|
-
}>;
|
|
102
|
-
processingMutex: {
|
|
103
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
104
|
-
};
|
|
105
|
-
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
106
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
107
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
108
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
109
|
-
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
110
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
111
|
-
exists: boolean;
|
|
112
|
-
jid: string;
|
|
113
|
-
}[]>;
|
|
114
|
-
fetchBlocklist: () => Promise<string[]>;
|
|
115
|
-
fetchStatus: (jid: string) => Promise<{
|
|
116
|
-
status: string | undefined;
|
|
117
|
-
setAt: Date;
|
|
118
|
-
} | undefined>;
|
|
119
|
-
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
120
|
-
removeProfilePicture: (jid: string) => Promise<void>;
|
|
121
|
-
updateProfileStatus: (status: string) => Promise<void>;
|
|
122
|
-
updateProfileName: (name: string) => Promise<void>;
|
|
123
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
124
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
125
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
126
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
127
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
128
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
129
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
130
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
131
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
132
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
133
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
134
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
135
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
136
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
137
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
138
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
139
|
-
star: (jid: string, messages: {
|
|
140
|
-
id: string;
|
|
141
|
-
fromMe?: boolean;
|
|
142
|
-
}[], star: boolean) => Promise<void>;
|
|
143
|
-
type: "md";
|
|
144
|
-
ws: any;
|
|
145
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
146
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
147
|
-
buffer(): void;
|
|
148
|
-
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
149
|
-
flush(force?: boolean): boolean;
|
|
150
|
-
isBuffering(): boolean;
|
|
151
|
-
};
|
|
152
|
-
authState: {
|
|
153
|
-
creds: import("../Types").AuthenticationCreds;
|
|
154
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
155
|
-
};
|
|
156
|
-
signalRepository: import("../Types").SignalRepository;
|
|
157
|
-
user: import("../Types").Contact | undefined;
|
|
158
|
-
generateMessageTag: () => string;
|
|
159
|
-
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number) => Promise<import("../WABinary").BinaryNode>;
|
|
160
|
-
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
|
|
161
|
-
waitForSocketOpen: () => Promise<void>;
|
|
162
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
163
|
-
sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
|
|
164
|
-
logout: (msg?: string) => Promise<void>;
|
|
165
|
-
end: (error: Error | undefined) => void;
|
|
166
|
-
onUnexpectedError: (err: Error | axios, msg: string) => void;
|
|
167
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
168
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
169
|
-
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
170
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
171
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
|
|
172
|
-
};
|
|
173
|
-
export interface RegistrationData {
|
|
174
|
-
registrationId: number;
|
|
175
|
-
signedPreKey: SignedKeyPair;
|
|
176
|
-
noiseKey: KeyPair;
|
|
177
|
-
signedIdentityKey: KeyPair;
|
|
178
|
-
identityId: Buffer;
|
|
179
|
-
phoneId: string;
|
|
180
|
-
deviceId: string;
|
|
181
|
-
backupToken: Buffer;
|
|
182
|
-
}
|
|
183
|
-
export interface RegistrationOptions {
|
|
184
|
-
/** your phone number */
|
|
185
|
-
phoneNumber?: string;
|
|
186
|
-
/** the country code of your phone number */
|
|
187
|
-
phoneNumberCountryCode: string;
|
|
188
|
-
/** your phone number without country code */
|
|
189
|
-
phoneNumberNationalNumber: string;
|
|
190
|
-
/** the country code of your mobile network
|
|
191
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
|
|
192
|
-
*/
|
|
193
|
-
phoneNumberMobileCountryCode: string;
|
|
194
|
-
/** the network code of your mobile network
|
|
195
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
|
196
|
-
*/
|
|
197
|
-
phoneNumberMobileNetworkCode: string;
|
|
198
|
-
/**
|
|
199
|
-
* How to send the one time code
|
|
200
|
-
*/
|
|
201
|
-
method?: 'sms' | 'voice' | 'captcha';
|
|
202
|
-
/**
|
|
203
|
-
* The captcha code if it was requested
|
|
204
|
-
*/
|
|
205
|
-
captcha?: string;
|
|
206
|
-
}
|
|
207
|
-
export type RegistrationParams = RegistrationData & RegistrationOptions;
|
|
208
|
-
export declare function registrationParams(params: RegistrationParams): {
|
|
209
|
-
cc: string;
|
|
210
|
-
in: string;
|
|
211
|
-
Rc: string;
|
|
212
|
-
lg: string;
|
|
213
|
-
lc: string;
|
|
214
|
-
mistyped: string;
|
|
215
|
-
authkey: any;
|
|
216
|
-
e_regid: any;
|
|
217
|
-
e_keytype: string;
|
|
218
|
-
e_ident: any;
|
|
219
|
-
e_skey_id: string;
|
|
220
|
-
e_skey_val: any;
|
|
221
|
-
e_skey_sig: any;
|
|
222
|
-
fdid: string;
|
|
223
|
-
network_ratio_type: string;
|
|
224
|
-
expid: string;
|
|
225
|
-
simnum: string;
|
|
226
|
-
hasinrc: string;
|
|
227
|
-
pid: string;
|
|
228
|
-
id: string;
|
|
229
|
-
backup_token: string;
|
|
230
|
-
token: any;
|
|
231
|
-
fraud_checkpoint_code: string | undefined;
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Requests a registration code for the given phone number.
|
|
235
|
-
*/
|
|
236
|
-
export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
237
|
-
export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
238
|
-
/**
|
|
239
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
240
|
-
*/
|
|
241
|
-
export declare function mobileRegister(params: RegistrationParams & {
|
|
242
|
-
code: string;
|
|
243
|
-
}, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
244
|
-
/**
|
|
245
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
246
|
-
*/
|
|
247
|
-
export declare function mobileRegisterEncrypt(data: string): any;
|
|
248
|
-
export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
249
|
-
export interface ExistsResponse {
|
|
250
|
-
status: 'fail' | 'sent';
|
|
251
|
-
voice_length?: number;
|
|
252
|
-
voice_wait?: number;
|
|
253
|
-
sms_length?: number;
|
|
254
|
-
sms_wait?: number;
|
|
255
|
-
reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
|
|
256
|
-
login?: string;
|
|
257
|
-
flash_type?: number;
|
|
258
|
-
ab_hash?: string;
|
|
259
|
-
ab_key?: string;
|
|
260
|
-
exp_cfg?: string;
|
|
261
|
-
lid?: string;
|
|
262
|
-
image_blob?: string;
|
|
263
|
-
audio_blob?: string;
|
|
264
|
-
}
|