dcodeindra-baileyspro 2.3.9

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2534 -0
  3. package/WAProto/Adv/Adv.d.ts +518 -0
  4. package/WAProto/Adv/Adv.js +1734 -0
  5. package/WAProto/Adv/Adv.proto +36 -0
  6. package/WAProto/BotMetadata/BotMetadata.d.ts +5745 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +16291 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +463 -0
  9. package/WAProto/Cert/Cert.d.ts +497 -0
  10. package/WAProto/Cert/Cert.js +1503 -0
  11. package/WAProto/Cert/Cert.proto +28 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +391 -0
  13. package/WAProto/ChatLockSettings/ChatLockSettings.js +1155 -0
  14. package/WAProto/ChatLockSettings/ChatLockSettings.proto +7 -0
  15. package/WAProto/CompanionReg/CompanionReg.d.ts +1055 -0
  16. package/WAProto/CompanionReg/CompanionReg.js +3532 -0
  17. package/WAProto/CompanionReg/CompanionReg.proto +89 -0
  18. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +187 -0
  19. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +520 -0
  20. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +14 -0
  21. package/WAProto/E2E/E2E.d.ts +28417 -0
  22. package/WAProto/E2E/E2E.js +98438 -0
  23. package/WAProto/E2E/E2E.proto +2289 -0
  24. package/WAProto/Ephemeral/Ephemeral.d.ts +95 -0
  25. package/WAProto/Ephemeral/Ephemeral.js +269 -0
  26. package/WAProto/Ephemeral/Ephemeral.proto +6 -0
  27. package/WAProto/HistorySync/HistorySync.d.ts +40728 -0
  28. package/WAProto/HistorySync/HistorySync.js +142980 -0
  29. package/WAProto/HistorySync/HistorySync.proto +207 -0
  30. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +189 -0
  31. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +585 -0
  32. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +11 -0
  33. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +461 -0
  34. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +1559 -0
  35. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +37 -0
  36. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +29294 -0
  37. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +101732 -0
  38. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +76 -0
  39. package/WAProto/MmsRetry/MmsRetry.d.ts +200 -0
  40. package/WAProto/MmsRetry/MmsRetry.js +586 -0
  41. package/WAProto/MmsRetry/MmsRetry.proto +17 -0
  42. package/WAProto/Protocol/Protocol.d.ts +218 -0
  43. package/WAProto/Protocol/Protocol.js +701 -0
  44. package/WAProto/Protocol/Protocol.proto +20 -0
  45. package/WAProto/Reporting/Reporting.d.ts +301 -0
  46. package/WAProto/Reporting/Reporting.js +989 -0
  47. package/WAProto/Reporting/Reporting.proto +19 -0
  48. package/WAProto/ServerSync/ServerSync.d.ts +1050 -0
  49. package/WAProto/ServerSync/ServerSync.js +3176 -0
  50. package/WAProto/ServerSync/ServerSync.proto +59 -0
  51. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +1507 -0
  52. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +4756 -0
  53. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +88 -0
  54. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +617 -0
  55. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1940 -0
  56. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +38 -0
  57. package/WAProto/StatusAttributions/StatusAttributions.d.ts +636 -0
  58. package/WAProto/StatusAttributions/StatusAttributions.js +2037 -0
  59. package/WAProto/StatusAttributions/StatusAttributions.proto +61 -0
  60. package/WAProto/SyncAction/SyncAction.d.ts +7227 -0
  61. package/WAProto/SyncAction/SyncAction.js +22271 -0
  62. package/WAProto/SyncAction/SyncAction.proto +423 -0
  63. package/WAProto/UserPassword/UserPassword.d.ts +298 -0
  64. package/WAProto/UserPassword/UserPassword.js +898 -0
  65. package/WAProto/UserPassword/UserPassword.proto +27 -0
  66. package/WAProto/VnameCert/VnameCert.d.ts +658 -0
  67. package/WAProto/VnameCert/VnameCert.js +2225 -0
  68. package/WAProto/VnameCert/VnameCert.proto +60 -0
  69. package/WAProto/Wa6/Wa6.d.ts +1613 -0
  70. package/WAProto/Wa6/Wa6.js +6299 -0
  71. package/WAProto/Wa6/Wa6.proto +229 -0
  72. package/WAProto/Web/Web.d.ts +31718 -0
  73. package/WAProto/Web/Web.js +113402 -0
  74. package/WAProto/Web/Web.proto +545 -0
  75. package/WAProto/index.d.ts +49 -0
  76. package/WAProto/index.js +28 -0
  77. package/WASignalGroup/GroupProtocol.js +1771 -0
  78. package/WASignalGroup/ciphertext_message.js +10 -0
  79. package/WASignalGroup/group_cipher.js +103 -0
  80. package/WASignalGroup/group_session_builder.js +39 -0
  81. package/WASignalGroup/index.js +5 -0
  82. package/WASignalGroup/keyhelper.js +17 -0
  83. package/WASignalGroup/protobufs.js +2 -0
  84. package/WASignalGroup/queue_job.js +64 -0
  85. package/WASignalGroup/sender_chain_key.js +38 -0
  86. package/WASignalGroup/sender_key_distribution_message.js +68 -0
  87. package/WASignalGroup/sender_key_message.js +79 -0
  88. package/WASignalGroup/sender_key_name.js +59 -0
  89. package/WASignalGroup/sender_key_record.js +47 -0
  90. package/WASignalGroup/sender_key_state.js +110 -0
  91. package/WASignalGroup/sender_message_key.js +30 -0
  92. package/check-node-version.js +10 -0
  93. package/lib/Defaults/baileys-version.json +3 -0
  94. package/lib/Defaults/index.d.ts +51 -0
  95. package/lib/Defaults/index.js +108 -0
  96. package/lib/Defaults/phonenumber-mcc.json +223 -0
  97. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  98. package/lib/Signal/Group/ciphertext-message.js +19 -0
  99. package/lib/Signal/Group/group-session-builder.d.ts +17 -0
  100. package/lib/Signal/Group/group-session-builder.js +72 -0
  101. package/lib/Signal/Group/group_cipher.d.ts +19 -0
  102. package/lib/Signal/Group/group_cipher.js +99 -0
  103. package/lib/Signal/Group/index.d.ts +11 -0
  104. package/lib/Signal/Group/index.js +61 -0
  105. package/lib/Signal/Group/keyhelper.d.ts +16 -0
  106. package/lib/Signal/Group/keyhelper.js +66 -0
  107. package/lib/Signal/Group/queue-job.d.ts +1 -0
  108. package/lib/Signal/Group/queue-job.js +64 -0
  109. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  110. package/lib/Signal/Group/sender-chain-key.js +39 -0
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  112. package/lib/Signal/Group/sender-key-distribution-message.js +71 -0
  113. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  114. package/lib/Signal/Group/sender-key-message.js +73 -0
  115. package/lib/Signal/Group/sender-key-name.d.ts +19 -0
  116. package/lib/Signal/Group/sender-key-name.js +59 -0
  117. package/lib/Signal/Group/sender-key-record.d.ts +32 -0
  118. package/lib/Signal/Group/sender-key-record.js +53 -0
  119. package/lib/Signal/Group/sender-key-record.ts +77 -0
  120. package/lib/Signal/Group/sender-key-state.d.ts +44 -0
  121. package/lib/Signal/Group/sender-key-state.js +104 -0
  122. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  123. package/lib/Signal/Group/sender-message-key.js +33 -0
  124. package/lib/Signal/libsignal.d.ts +3 -0
  125. package/lib/Signal/libsignal.js +153 -0
  126. package/lib/Socket/Client/index.d.ts +2 -0
  127. package/lib/Socket/Client/index.js +18 -0
  128. package/lib/Socket/Client/types.d.ts +15 -0
  129. package/lib/Socket/Client/types.js +14 -0
  130. package/lib/Socket/Client/websocket.d.ts +12 -0
  131. package/lib/Socket/Client/websocket.js +57 -0
  132. package/lib/Socket/business.d.ts +181 -0
  133. package/lib/Socket/business.js +259 -0
  134. package/lib/Socket/chats.d.ts +95 -0
  135. package/lib/Socket/chats.js +906 -0
  136. package/lib/Socket/community.d.ts +131 -0
  137. package/lib/Socket/community.js +369 -0
  138. package/lib/Socket/groups.d.ts +122 -0
  139. package/lib/Socket/groups.js +360 -0
  140. package/lib/Socket/index.d.ts +183 -0
  141. package/lib/Socket/index.js +10 -0
  142. package/lib/Socket/messages-recv.d.ts +170 -0
  143. package/lib/Socket/messages-recv.js +1074 -0
  144. package/lib/Socket/messages-send.d.ts +161 -0
  145. package/lib/Socket/messages-send.js +982 -0
  146. package/lib/Socket/newsletter.d.ts +140 -0
  147. package/lib/Socket/newsletter.js +242 -0
  148. package/lib/Socket/socket.d.ts +43 -0
  149. package/lib/Socket/socket.js +749 -0
  150. package/lib/Socket/usync.d.ts +36 -0
  151. package/lib/Socket/usync.js +71 -0
  152. package/lib/Store/index.d.ts +4 -0
  153. package/lib/Store/index.js +20 -0
  154. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  155. package/lib/Store/make-cache-manager-store.js +77 -0
  156. package/lib/Store/make-in-memory-store.d.ts +117 -0
  157. package/lib/Store/make-in-memory-store.js +420 -0
  158. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  159. package/lib/Store/make-ordered-dictionary.js +83 -0
  160. package/lib/Store/object-repository.d.ts +10 -0
  161. package/lib/Store/object-repository.js +28 -0
  162. package/lib/Types/Auth.d.ts +103 -0
  163. package/lib/Types/Auth.js +2 -0
  164. package/lib/Types/Call.d.ts +13 -0
  165. package/lib/Types/Call.js +2 -0
  166. package/lib/Types/Chat.d.ts +115 -0
  167. package/lib/Types/Chat.js +6 -0
  168. package/lib/Types/Contact.d.ts +35 -0
  169. package/lib/Types/Contact.js +2 -0
  170. package/lib/Types/Events.d.ts +208 -0
  171. package/lib/Types/Events.js +2 -0
  172. package/lib/Types/GroupMetadata.d.ts +81 -0
  173. package/lib/Types/GroupMetadata.js +2 -0
  174. package/lib/Types/Label.d.ts +46 -0
  175. package/lib/Types/Label.js +28 -0
  176. package/lib/Types/LabelAssociation.d.ts +29 -0
  177. package/lib/Types/LabelAssociation.js +10 -0
  178. package/lib/Types/Message.d.ts +480 -0
  179. package/lib/Types/Message.js +9 -0
  180. package/lib/Types/MexUpdates.d.ts +9 -0
  181. package/lib/Types/MexUpdates.js +18 -0
  182. package/lib/Types/Newsletter.d.ts +92 -0
  183. package/lib/Types/Newsletter.js +33 -0
  184. package/lib/Types/Product.d.ts +78 -0
  185. package/lib/Types/Product.js +2 -0
  186. package/lib/Types/Signal.d.ts +57 -0
  187. package/lib/Types/Signal.js +2 -0
  188. package/lib/Types/Socket.d.ts +116 -0
  189. package/lib/Types/Socket.js +2 -0
  190. package/lib/Types/State.d.ts +27 -0
  191. package/lib/Types/State.js +2 -0
  192. package/lib/Types/USync.d.ts +25 -0
  193. package/lib/Types/USync.js +2 -0
  194. package/lib/Types/index.d.ts +70 -0
  195. package/lib/Types/index.js +42 -0
  196. package/lib/Utils/auth-utils.d.ts +18 -0
  197. package/lib/Utils/auth-utils.js +198 -0
  198. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  199. package/lib/Utils/baileys-event-stream.js +64 -0
  200. package/lib/Utils/business.d.ts +22 -0
  201. package/lib/Utils/business.js +243 -0
  202. package/lib/Utils/chat-utils.d.ts +72 -0
  203. package/lib/Utils/chat-utils.js +762 -0
  204. package/lib/Utils/crypto.d.ts +40 -0
  205. package/lib/Utils/crypto.js +150 -0
  206. package/lib/Utils/decode-wa-message.d.ts +252 -0
  207. package/lib/Utils/decode-wa-message.js +232 -0
  208. package/lib/Utils/event-buffer.d.ts +35 -0
  209. package/lib/Utils/event-buffer.js +539 -0
  210. package/lib/Utils/generics.d.ts +96 -0
  211. package/lib/Utils/generics.js +553 -0
  212. package/lib/Utils/history.d.ts +29 -0
  213. package/lib/Utils/history.js +109 -0
  214. package/lib/Utils/index.d.ts +19 -0
  215. package/lib/Utils/index.js +35 -0
  216. package/lib/Utils/link-preview.d.ts +21 -0
  217. package/lib/Utils/link-preview.js +112 -0
  218. package/lib/Utils/logger.d.ts +11 -0
  219. package/lib/Utils/logger.js +7 -0
  220. package/lib/Utils/lt-hash.d.ts +12 -0
  221. package/lib/Utils/lt-hash.js +53 -0
  222. package/lib/Utils/make-mutex.d.ts +7 -0
  223. package/lib/Utils/make-mutex.js +45 -0
  224. package/lib/Utils/messages-media.d.ts +104 -0
  225. package/lib/Utils/messages-media.js +751 -0
  226. package/lib/Utils/messages.d.ts +80 -0
  227. package/lib/Utils/messages.js +1741 -0
  228. package/lib/Utils/noise-handler.d.ts +19 -0
  229. package/lib/Utils/noise-handler.js +150 -0
  230. package/lib/Utils/process-message.d.ts +41 -0
  231. package/lib/Utils/process-message.js +391 -0
  232. package/lib/Utils/signal.d.ts +33 -0
  233. package/lib/Utils/signal.js +154 -0
  234. package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
  235. package/lib/Utils/use-mongo-file-auth-state.js +75 -0
  236. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  237. package/lib/Utils/use-multi-file-auth-state.js +123 -0
  238. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  239. package/lib/Utils/use-single-file-auth-state.js +75 -0
  240. package/lib/Utils/validate-connection.d.ts +10 -0
  241. package/lib/Utils/validate-connection.js +174 -0
  242. package/lib/WABinary/constants.d.ts +27 -0
  243. package/lib/WABinary/constants.js +45 -0
  244. package/lib/WABinary/decode.d.ts +6 -0
  245. package/lib/WABinary/decode.js +255 -0
  246. package/lib/WABinary/encode.d.ts +2 -0
  247. package/lib/WABinary/encode.js +243 -0
  248. package/lib/WABinary/generic-utils.d.ts +16 -0
  249. package/lib/WABinary/generic-utils.js +125 -0
  250. package/lib/WABinary/index.d.ts +5 -0
  251. package/lib/WABinary/index.js +21 -0
  252. package/lib/WABinary/jid-utils.d.ts +34 -0
  253. package/lib/WABinary/jid-utils.js +73 -0
  254. package/lib/WABinary/types.d.ts +18 -0
  255. package/lib/WABinary/types.js +2 -0
  256. package/lib/WAM/BinaryInfo.d.ts +16 -0
  257. package/lib/WAM/BinaryInfo.js +14 -0
  258. package/lib/WAM/constants.d.ts +39 -0
  259. package/lib/WAM/constants.js +15362 -0
  260. package/lib/WAM/encode.d.ts +2 -0
  261. package/lib/WAM/encode.js +156 -0
  262. package/lib/WAM/index.d.ts +3 -0
  263. package/lib/WAM/index.js +19 -0
  264. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
  265. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -0
  266. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  267. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  268. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  269. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +58 -0
  270. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  271. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  272. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
  273. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
  274. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  275. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  276. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  277. package/lib/WAUSync/Protocols/index.js +22 -0
  278. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  279. package/lib/WAUSync/USyncQuery.js +88 -0
  280. package/lib/WAUSync/USyncUser.d.ts +12 -0
  281. package/lib/WAUSync/USyncUser.js +27 -0
  282. package/lib/WAUSync/index.d.ts +3 -0
  283. package/lib/WAUSync/index.js +19 -0
  284. package/lib/index.d.ts +13 -0
  285. package/lib/index.js +45 -0
  286. package/package.json +63 -0
@@ -0,0 +1,131 @@
1
+ import { proto } from '../../WAProto'
2
+ import { GroupMetadata, ParticipantAction, SocketConfig, ContactAction } from '../Types'
3
+ import { BinaryNode } from '../WABinary'
4
+
5
+ export declare const makeCommunitiesSocket: (config: SocketConfig) => {
6
+ communityQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
7
+ communityMetadata: (jid: string) => Promise<GroupMetadata>
8
+ communityCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>
9
+ communityLeave: (id: string) => Promise<void>
10
+ communityUpdateSubject: (jid: string, subject: string) => Promise<void>
11
+ communityRequestParticipantsList: (jid: string) => Promise<{
12
+ [key: string]: string
13
+ }[]>
14
+ communityRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
15
+ status: string
16
+ jid: string
17
+ }[]>
18
+ communityParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
19
+ status: string
20
+ jid: string
21
+ content: BinaryNode
22
+ }[]>
23
+ communityUpdateDescription: (jid: string, description?: string) => Promise<void>
24
+ communityInviteCode: (jid: string) => Promise<string | undefined>
25
+ communityRevokeInvite: (jid: string) => Promise<string | undefined>
26
+ communityAcceptInvite: (code: string) => Promise<string | undefined>
27
+ /**
28
+ * revoke a v4 invite for someone
29
+ * @param communityJid community jid
30
+ * @param invitedJid jid of person you invited
31
+ * @returns true if successful
32
+ */
33
+ communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>
34
+ /**
35
+ * accept a GroupInviteMessage
36
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
37
+ * @param inviteMessage the message to accept
38
+ */
39
+ communityAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>
40
+ communityGetInviteInfo: (code: string) => Promise<GroupMetadata>
41
+ communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
42
+ communitySettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>
43
+ communityMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>
44
+ communityJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>
45
+ communityFetchAllParticipating: () => Promise<{
46
+ [_: string]: GroupMetadata
47
+ }>
48
+ processingMutex: {
49
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
50
+ }
51
+ fetchPrivacySettings: (force?: boolean) => Promise<{
52
+ [_: string]: string
53
+ }>
54
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
55
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
56
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
57
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
58
+ getLidUser: (jid: string) => Promise<{
59
+ lid: string
60
+ id: string
61
+ }[] | undefined>
62
+ onWhatsApp: (...jids: string[]) => Promise<{
63
+ jid: string
64
+ exists: unknown
65
+ }[] | undefined>
66
+ fetchBlocklist: () => Promise<string[]>
67
+ fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
68
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
69
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
70
+ removeProfilePicture: (jid: string) => Promise<void>
71
+ updateProfileStatus: (status: string) => Promise<void>
72
+ updateProfileName: (name: string) => Promise<void>
73
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
74
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
75
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
76
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
77
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
78
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
79
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
80
+ updatecommunitysAddPrivacy: (value: import("../Types").WAPrivacycommunityAddValue) => Promise<void>
81
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
82
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>
83
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
84
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
85
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
86
+ cleanDirtyBits: (type: "account_sync" | "communitys", fromTimestamp?: string | number | undefined) => Promise<void>
87
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>
88
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
89
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
90
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
91
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
92
+ clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
93
+ star: (jid: string, messages: {
94
+ id: string
95
+ fromMe?: boolean | undefined
96
+ }[], star: boolean) => Promise<void>
97
+ addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
98
+ removeContact: (jid: string) => Promise<void>
99
+ executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>
100
+ type: "md"
101
+ ws: import("./Client").WebSocketClient
102
+ ev: import("../Types").BaileysEventEmitter & {
103
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
104
+ buffer(): void
105
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
106
+ flush(force?: boolean | undefined): boolean
107
+ isBuffering(): boolean
108
+ }
109
+ authState: {
110
+ creds: import("../Types").AuthenticationCreds
111
+ keys: import("../Types").SignalKeyStoreWithTransaction
112
+ }
113
+ signalRepository: import("../Types").SignalRepository
114
+ user: import("../Types").Contact | undefined
115
+ generateMessageTag: () => string
116
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
117
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
118
+ waitForSocketOpen: () => Promise<void>
119
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
120
+ sendNode: (frame: BinaryNode) => Promise<void>
121
+ logout: (msg?: string | undefined) => Promise<void>
122
+ end: (error: Error | undefined) => void
123
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
124
+ uploadPreKeys: (count?: number) => Promise<void>
125
+ uploadPreKeysToServerIfRequired: () => Promise<void>
126
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
127
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
128
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
129
+ }
130
+
131
+ export declare const extractCommunityMetadata: (result: BinaryNode) => GroupMetadata
@@ -0,0 +1,369 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+
4
+ const WAProto_1 = require("../../WAProto")
5
+ const Types_1 = require("../Types")
6
+ const Utils_1 = require("../Utils")
7
+ const WABinary_1 = require("../WABinary")
8
+ const business_1 = require("./business")
9
+
10
+ const makeCommunitiesSocket = (config) => {
11
+ const suki = business_1.makeBusinessSocket(config)
12
+ const { authState, ev, query, groupMetadata, upsertMessage } = suki
13
+
14
+ const communityQuery = async (jid, type, content) => (query({
15
+ tag: 'iq',
16
+ attrs: {
17
+ type,
18
+ xmlns: 'w:g2',
19
+ to: jid,
20
+ },
21
+ content
22
+ }))
23
+
24
+ const communityMetadata = async (jid) => {
25
+ const result = await communityQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }])
26
+ return extractCommunityMetadata(result)
27
+ }
28
+
29
+ const communityFetchAllParticipating = async () => {
30
+ const result = await query({
31
+ tag: 'iq',
32
+ attrs: {
33
+ to: '@g.us',
34
+ xmlns: 'w:g2',
35
+ type: 'get',
36
+ },
37
+ content: [
38
+ {
39
+ tag: 'participating',
40
+ attrs: {},
41
+ content: [
42
+ { tag: 'participants', attrs: {} },
43
+ { tag: 'description', attrs: {} }
44
+ ]
45
+ }
46
+ ]
47
+ })
48
+
49
+ const data = {}
50
+ const communitiesChild = WABinary_1.getBinaryNodeChild(result, 'communities')
51
+
52
+ if (communitiesChild) {
53
+ const communities = WABinary_1.getBinaryNodeChildren(communitiesChild, 'community')
54
+ for (const communityNode of communities) {
55
+ const meta = extractCommunityMetadata({
56
+ tag: 'result',
57
+ attrs: {},
58
+ content: [communityNode]
59
+ })
60
+ data[meta.id] = meta
61
+ }
62
+ }
63
+
64
+ suki.ev.emit('groups.update', Object.values(data))
65
+ return data
66
+ }
67
+
68
+ suki.ws.on('CB:ib,,dirty', async (node) => {
69
+ const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty')
70
+
71
+ if (attrs.type !== 'communities') {
72
+ return
73
+ }
74
+
75
+ await communityFetchAllParticipating()
76
+ await suki.cleanDirtyBits('groups')
77
+ })
78
+
79
+ return {
80
+ ...suki,
81
+ communityQuery,
82
+ communityMetadata,
83
+ communityCreate: async (subject, body) => {
84
+ const descriptionId = Utils_1.generateMessageID().substring(0, 12)
85
+
86
+ const result = await communityQuery('@g.us', 'set', [
87
+ {
88
+ tag: 'create',
89
+ attrs: { subject },
90
+ content: [{
91
+ tag: 'description',
92
+ attrs: {
93
+ id: descriptionId
94
+ },
95
+ content: [{
96
+ tag: 'body',
97
+ attrs: {},
98
+ content: Buffer.from(body || '', 'utf-8')
99
+ }]
100
+ },
101
+ {
102
+ tag: 'parent',
103
+ attrs: {
104
+ default_membership_approval_mode: 'request_required'
105
+ }
106
+ },
107
+ {
108
+ tag: 'allow_non_admin_sub_group_creation',
109
+ attrs: {}
110
+ },
111
+ {
112
+ tag: 'create_general_chat',
113
+ attrs: {}
114
+ }]
115
+ }
116
+ ])
117
+
118
+ return extractCommunityMetadata(result)
119
+ },
120
+ communityLeave: async (id) => {
121
+ await communityQuery('@g.us', 'set', [
122
+ {
123
+ tag: 'leave',
124
+ attrs: {},
125
+ content: [
126
+ { tag: 'community', attrs: { id } }
127
+ ]
128
+ }
129
+ ])
130
+ },
131
+ communityUpdateSubject: async (jid, subject) => {
132
+ await communityQuery(jid, 'set', [
133
+ {
134
+ tag: 'subject',
135
+ attrs: {},
136
+ content: Buffer.from(subject, 'utf-8')
137
+ }
138
+ ])
139
+ },
140
+ communityRequestParticipantsList: async (jid) => {
141
+ const result = await communityQuery(jid, 'get', [
142
+ {
143
+ tag: 'membership_approval_requests',
144
+ attrs: {}
145
+ }
146
+ ])
147
+
148
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests')
149
+ const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request')
150
+
151
+ return participants.map(v => v.attrs)
152
+ },
153
+ communityRequestParticipantsUpdate: async (jid, participants, action) => {
154
+ const result = await communityQuery(jid, 'set', [{
155
+ tag: 'membership_requests_action',
156
+ attrs: {},
157
+ content: [
158
+ {
159
+ tag: action,
160
+ attrs: {},
161
+ content: participants.map(jid => ({
162
+ tag: 'participant',
163
+ attrs: { jid }
164
+ }))
165
+ }
166
+ ]
167
+ }])
168
+
169
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action')
170
+ const nodeAction = WABinary_1.getBinaryNodeChild(node, action)
171
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant')
172
+
173
+ return participantsAffected.map(p => {
174
+ return { status: p.attrs.error || '200', jid: p.attrs.jid }
175
+ })
176
+ },
177
+ communityParticipantsUpdate: async (jid, participants, action) => {
178
+ const result = await communityQuery(jid, 'set', [
179
+ {
180
+ tag: action,
181
+ attrs: {},
182
+ content: participants.map(jid => ({
183
+ tag: 'participant',
184
+ attrs: { jid }
185
+ }))
186
+ }
187
+ ])
188
+ const node = WABinary_1.getBinaryNodeChild(result, action)
189
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant')
190
+
191
+ return participantsAffected.map(p => {
192
+ return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p }
193
+ })
194
+ },
195
+ communityUpdateDescription: async (jid, description) => {
196
+ const metadata = await communityMetadata(jid)
197
+ const prev = metadata.descId ? metadata.descId : null
198
+
199
+ await communityQuery(jid, 'set', [
200
+ {
201
+ tag: 'description',
202
+ attrs: {
203
+ ...(description ? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
204
+ ...(prev ? { prev } : {})
205
+ },
206
+ content: description ? [
207
+ { tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }
208
+ ] : undefined
209
+ }
210
+ ])
211
+ },
212
+ communityInviteCode: async (jid) => {
213
+ const result = await communityQuery(jid, 'get', [{ tag: 'invite', attrs: {} }])
214
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite')
215
+
216
+ return inviteNode?.attrs?.code
217
+ },
218
+ communityRevokeInvite: async (jid) => {
219
+ const result = await communityQuery(jid, 'set', [{ tag: 'invite', attrs: {} }])
220
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite')
221
+
222
+ return inviteNode?.attrs?.code
223
+ },
224
+ communityAcceptInvite: async (code) => {
225
+ const results = await communityQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }])
226
+ const result = WABinary_1.getBinaryNodeChild(results, 'community')
227
+
228
+ return result?.attrs?.jid
229
+ },
230
+ /**
231
+ * revoke a v4 invite for someone
232
+ * @param communityJid community jid
233
+ * @param invitedJid jid of person you invited
234
+ * @returns true if successful
235
+ */
236
+ communityRevokeInviteV4: async (communityJid, invitedJid) => {
237
+ const result = await communityQuery(communityJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }])
238
+
239
+ return !!result
240
+ },
241
+ /**
242
+ * accept a GroupInviteMessage
243
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
244
+ * @param inviteMessage the message to accept
245
+ */
246
+ communityAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
247
+ key = typeof key === 'string' ? { remoteJid: key } : key
248
+ const results = await communityQuery(inviteMessage.groupJid, 'set', [{
249
+ tag: 'accept',
250
+ attrs: {
251
+ code: inviteMessage.inviteCode,
252
+ expiration: inviteMessage.inviteExpiration.toString(),
253
+ admin: key.remoteJid
254
+ }
255
+ }])
256
+
257
+ // if we have the full message key
258
+ // update the invite message to be expired
259
+ if (key.id) {
260
+ // create new invite message that is expired
261
+ inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage)
262
+ inviteMessage.inviteExpiration = 0
263
+ inviteMessage.inviteCode = ''
264
+ ev.emit('messages.update', [
265
+ {
266
+ key,
267
+ update: {
268
+ message: {
269
+ groupInviteMessage: inviteMessage
270
+ }
271
+ }
272
+ }
273
+ ])
274
+ }
275
+
276
+ // generate the group add message
277
+ await upsertMessage({
278
+ key: {
279
+ remoteJid: inviteMessage.groupJid,
280
+ id: Utils_1.generateMessageID(authState.creds.me?.id),
281
+ fromMe: false,
282
+ participant: key.remoteJid,
283
+ },
284
+ messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
285
+ messageStubParameters: [
286
+ authState.creds.me.id
287
+ ],
288
+ participant: key.remoteJid,
289
+ messageTimestamp: Utils_1.unixTimestampSeconds()
290
+ }, 'notify')
291
+
292
+ return results.attrs.from
293
+ }),
294
+ communityGetInviteInfo: async (code) => {
295
+ const results = await communityQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }])
296
+
297
+ return extractCommunityMetadata(results)
298
+ },
299
+ communityToggleEphemeral: async (jid, ephemeralExpiration) => {
300
+ const content = ephemeralExpiration ?
301
+ { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
302
+ { tag: 'not_ephemeral', attrs: {} }
303
+ await communityQuery(jid, 'set', [content])
304
+ },
305
+ communitySettingUpdate: async (jid, setting) => {
306
+ await communityQuery(jid, 'set', [{ tag: setting, attrs: {} }])
307
+ },
308
+ communityMemberAddMode: async (jid, mode) => {
309
+ await communityQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }])
310
+ },
311
+ communityJoinApprovalMode: async (jid, mode) => {
312
+ await communityQuery(jid, 'set', [{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'community_join', attrs: { state: mode } }] }])
313
+ },
314
+ communityFetchAllParticipating
315
+ }
316
+ }
317
+
318
+ const extractCommunityMetadata = (result) => {
319
+ const community = WABinary_1.getBinaryNodeChild(result, 'group')
320
+ const descChild = WABinary_1.getBinaryNodeChild(community, 'description')
321
+
322
+ let desc
323
+ let descId
324
+
325
+ if (descChild) {
326
+ desc = WABinary_1.getBinaryNodeChildString(descChild, 'body')
327
+ descId = descChild.attrs.id
328
+ }
329
+
330
+ const mode = community.attrs.addressing_mode
331
+ const communityId = community.attrs.id.includes('@') ? community.attrs.id : WABinary_1.jidEncode(community.attrs.id, 'g.us')
332
+ const eph = WABinary_1.getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration
333
+ const memberAddMode = WABinary_1.getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add'
334
+
335
+ const metadata = {
336
+ id: communityId,
337
+ addressingMode: mode,
338
+ subject: community.attrs.subject,
339
+ subjectOwner: mode === 'lid' ? community.attrs.s_o_pn : community.attrs.s_o,
340
+ subjectTime: +community.attrs.s_t,
341
+ size: community.attrs?.size ? +community.attrs.size : WABinary_1.getBinaryNodeChildren(community, 'participant').length,
342
+ creation: +community.attrs.creation,
343
+ owner: community.attrs.creator ? WABinary_1.jidNormalizedUser(mode === 'lid' ? community.attrs.creator_pn : community.attrs.creator) : undefined,
344
+ desc,
345
+ descId,
346
+ linkedParent: WABinary_1.getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
347
+ restrict: !!WABinary_1.getBinaryNodeChild(community, 'locked'),
348
+ announce: !!WABinary_1.getBinaryNodeChild(community, 'announcement'),
349
+ isCommunity: !!WABinary_1.getBinaryNodeChild(community, 'parent'),
350
+ isCommunityAnnounce: !!WABinary_1.getBinaryNodeChild(community, 'default_sub_group'),
351
+ joinApprovalMode: !!WABinary_1.getBinaryNodeChild(community, 'membership_approval_mode'),
352
+ memberAddMode,
353
+ participants: WABinary_1.getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
354
+ return {
355
+ id: mode === 'lid' ? community.phone_number : attrs.jid,
356
+ lid: mode === 'lid' ? community.jid : attrs.lid,
357
+ admin: (attrs.type || null),
358
+ }
359
+ }),
360
+ ephemeralDuration: eph ? +eph : undefined,
361
+ }
362
+
363
+ return metadata
364
+ }
365
+
366
+ module.exports = {
367
+ makeCommunitiesSocket,
368
+ extractCommunityMetadata
369
+ }
@@ -0,0 +1,122 @@
1
+ import { proto } from '../../WAProto'
2
+ import { GroupMetadata, ParticipantAction, SocketConfig, ContactAction, WAPrivacyValue, WAPrivacyOnlineValue, WAPrivacyCallValue, WAReadReceiptsValue, WAPrivacyGroupAddValue, WABusinessProfile, WAMessageStubType, MessageUpsertType, WAPresence, WAMediaUpload, USyncQuery, USyncQueryResult, USyncQueryResultList } from '../Types'
3
+ import { BinaryNode } from '../WABinary'
4
+ import { BaileysEventEmitter, AuthenticationCreds, SignalKeyStoreWithTransaction, SignalRepository, Contact, ChatModification, LabelActionBody } from '../Types'
5
+
6
+ export declare const makeGroupsSocket: (config: SocketConfig) => {
7
+ groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
8
+ groupMetadata: (jid: string) => Promise<GroupMetadata>
9
+ groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>
10
+ groupLeave: (id: string) => Promise<void>
11
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>
12
+ groupRequestParticipantsList: (jid: string) => Promise<{
13
+ [key: string]: string
14
+ }[]>
15
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
16
+ status: string
17
+ jid: string
18
+ }[]>
19
+ groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
20
+ status: string
21
+ jid: string
22
+ content: BinaryNode
23
+ }[]>
24
+ groupUpdateDescription: (jid: string, description?: string) => Promise<void>
25
+ groupInviteCode: (jid: string) => Promise<string | undefined>
26
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>
27
+ groupAcceptInvite: (code: string) => Promise<string | undefined>
28
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
29
+ groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>
30
+ groupGetInviteInfo: (code: string) => Promise<GroupMetadata>
31
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
32
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>
33
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>
34
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>
35
+ groupFetchAllParticipating: () => Promise<{
36
+ [_: string]: GroupMetadata
37
+ }>
38
+ processingMutex: {
39
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
40
+ }
41
+ fetchPrivacySettings: (force?: boolean) => Promise<{
42
+ [_: string]: string
43
+ }>
44
+ upsertMessage: (msg: proto.IWebMessageInfo, type: MessageUpsertType) => Promise<void>
45
+ appPatch: (patchCreate: WAPatchCreate) => Promise<void>
46
+ sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>
47
+ presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>
48
+ getLidUser: (jid: string) => Promise<{
49
+ lid: string
50
+ id: string
51
+ }[] | undefined>
52
+ onWhatsApp: (...jids: string[]) => Promise<{
53
+ jid: string
54
+ exists: boolean
55
+ }[] | undefined>
56
+ fetchBlocklist: () => Promise<string[]>
57
+ fetchStatus: (...jids: string[]) => Promise<USyncQueryResultList[] | undefined>
58
+ fetchDisappearingDuration: (...jids: string[]) => Promise<USyncQueryResultList[] | undefined>
59
+ updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>
60
+ removeProfilePicture: (jid: string) => Promise<void>
61
+ updateProfileStatus: (status: string) => Promise<void>
62
+ updateProfileName: (name: string) => Promise<void>
63
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
64
+ updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>
65
+ updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>
66
+ updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>
67
+ updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>
68
+ updateStatusPrivacy: (value: WAPrivacyValue) => Promise<void>
69
+ updateReadReceiptsPrivacy: (value: WAReadReceiptsValue) => Promise<void>
70
+ updateGroupsAddPrivacy: (value: WAPrivacyGroupAddValue) => Promise<void>
71
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
72
+ getBusinessProfile: (jid: string) => Promise<void | WABusinessProfile>
73
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
74
+ chatModify: (mod: ChatModification, jid: string) => Promise<void>
75
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number) => Promise<void>
76
+ addLabel: (jid: string, labels: LabelActionBody) => Promise<void>
77
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
78
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
79
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
80
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
81
+ clearMessage: (jid: string, key: proto.IMessageKey, timeStamp: number | Long) => Promise<void>
82
+ star: (jid: string, messages: {
83
+ id: string
84
+ fromMe?: boolean
85
+ }[], star: boolean) => Promise<void>
86
+ addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
87
+ removeContact: (jid: string) => Promise<void>
88
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<USyncQueryResult | undefined>
89
+
90
+ // Socket properties
91
+ type: "md"
92
+ ws: any // WebSocketClient type would need to be imported/defined
93
+ ev: BaileysEventEmitter & {
94
+ process(handler: (events: Partial<BaileysEventMap>) => void | Promise<void>): () => void
95
+ buffer(): void
96
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
97
+ flush(force?: boolean): boolean
98
+ isBuffering(): boolean
99
+ }
100
+ authState: {
101
+ creds: AuthenticationCreds
102
+ keys: SignalKeyStoreWithTransaction
103
+ }
104
+ signalRepository: SignalRepository
105
+ user: Contact | undefined
106
+ generateMessageTag: () => string
107
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>
108
+ waitForMessage: <T>(msgId: string, timeoutMs?: number) => Promise<T>
109
+ waitForSocketOpen: () => Promise<void>
110
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
111
+ sendNode: (frame: BinaryNode) => Promise<void>
112
+ logout: (msg?: string) => Promise<void>
113
+ end: (error: Error | undefined) => void
114
+ onUnexpectedError: (err: Error | Boom<any>, msg: string) => void
115
+ uploadPreKeys: (count?: number) => Promise<void>
116
+ uploadPreKeysToServerIfRequired: () => Promise<void>
117
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
118
+ waitForConnectionUpdate: (check: (u: Partial<ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>
119
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
120
+ }
121
+
122
+ export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata