@fer2809fl/baileys 1.4.9 → 7.0.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 (481) hide show
  1. package/LICENSE +21 -674
  2. package/README.md +556 -523
  3. package/WAProto/GenerateStatics.sh +3 -4
  4. package/WAProto/WAProto.proto +1215 -511
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.d.ts +4347 -45387
  7. package/WAProto/index.js +65475 -137445
  8. package/engine-requirements.js +10 -0
  9. package/lib/Defaults/index.d.ts +34 -18
  10. package/lib/Defaults/index.d.ts.map +1 -0
  11. package/lib/Defaults/index.js +95 -67
  12. package/lib/Defaults/index.js.map +1 -0
  13. package/lib/Signal/Group/ciphertext-message.d.ts +1 -0
  14. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  15. package/lib/Signal/Group/ciphertext-message.js +2 -5
  16. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  17. package/lib/Signal/Group/group-session-builder.d.ts +4 -3
  18. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  19. package/lib/Signal/Group/group-session-builder.js +7 -41
  20. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  21. package/lib/Signal/Group/group_cipher.d.ts +4 -4
  22. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  23. package/lib/Signal/Group/group_cipher.js +37 -60
  24. package/lib/Signal/Group/group_cipher.js.map +1 -0
  25. package/lib/Signal/Group/index.d.ts +12 -11
  26. package/lib/Signal/Group/index.d.ts.map +1 -0
  27. package/lib/Signal/Group/index.js +12 -57
  28. package/lib/Signal/Group/index.js.map +1 -0
  29. package/lib/Signal/Group/keyhelper.d.ts +2 -1
  30. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  31. package/lib/Signal/Group/keyhelper.js +7 -44
  32. package/lib/Signal/Group/keyhelper.js.map +1 -0
  33. package/lib/Signal/Group/sender-chain-key.d.ts +3 -2
  34. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  35. package/lib/Signal/Group/sender-chain-key.js +7 -15
  36. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.d.ts +2 -1
  38. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  39. package/lib/Signal/Group/sender-key-distribution-message.js +8 -11
  40. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  41. package/lib/Signal/Group/sender-key-message.d.ts +2 -1
  42. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  43. package/lib/Signal/Group/sender-key-message.js +9 -12
  44. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  45. package/lib/Signal/Group/sender-key-name.d.ts +1 -0
  46. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  47. package/lib/Signal/Group/sender-key-name.js +2 -5
  48. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  49. package/lib/Signal/Group/sender-key-record.d.ts +3 -2
  50. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  51. package/lib/Signal/Group/sender-key-record.js +12 -37
  52. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  53. package/lib/Signal/Group/sender-key-state.d.ts +7 -6
  54. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  55. package/lib/Signal/Group/sender-key-state.js +27 -42
  56. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  57. package/lib/Signal/Group/sender-message-key.d.ts +1 -0
  58. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  59. package/lib/Signal/Group/sender-message-key.js +4 -7
  60. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  61. package/lib/Signal/libsignal.d.ts +5 -3
  62. package/lib/Signal/libsignal.d.ts.map +1 -0
  63. package/lib/Signal/libsignal.js +347 -90
  64. package/lib/Signal/libsignal.js.map +1 -0
  65. package/lib/Signal/lid-mapping.d.ts +23 -0
  66. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  67. package/lib/Signal/lid-mapping.js +277 -0
  68. package/lib/Signal/lid-mapping.js.map +1 -0
  69. package/lib/Socket/Client/index.d.ts +3 -2
  70. package/lib/Socket/Client/index.d.ts.map +1 -0
  71. package/lib/Socket/Client/index.js +3 -18
  72. package/lib/Socket/Client/index.js.map +1 -0
  73. package/lib/Socket/Client/types.d.ts +4 -4
  74. package/lib/Socket/Client/types.d.ts.map +1 -0
  75. package/lib/Socket/Client/types.js +4 -6
  76. package/lib/Socket/Client/types.js.map +1 -0
  77. package/lib/Socket/Client/websocket.d.ts +3 -3
  78. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  79. package/lib/Socket/Client/websocket.js +21 -78
  80. package/lib/Socket/Client/websocket.js.map +1 -0
  81. package/lib/Socket/business.d.ts +205 -93
  82. package/lib/Socket/business.d.ts.map +1 -0
  83. package/lib/Socket/business.js +162 -43
  84. package/lib/Socket/business.js.map +1 -0
  85. package/lib/Socket/chats.d.ts +77 -28
  86. package/lib/Socket/chats.d.ts.map +1 -0
  87. package/lib/Socket/chats.js +639 -248
  88. package/lib/Socket/chats.js.map +1 -0
  89. package/lib/Socket/communities.d.ts +340 -0
  90. package/lib/Socket/communities.d.ts.map +1 -0
  91. package/lib/Socket/communities.js +434 -0
  92. package/lib/Socket/communities.js.map +1 -0
  93. package/lib/Socket/groups.d.ts +93 -46
  94. package/lib/Socket/groups.d.ts.map +1 -0
  95. package/lib/Socket/groups.js +260 -102
  96. package/lib/Socket/groups.js.map +1 -0
  97. package/lib/Socket/index.d.ts +253 -98
  98. package/lib/Socket/index.d.ts.map +1 -0
  99. package/lib/Socket/index.js +11 -9
  100. package/lib/Socket/index.js.map +1 -0
  101. package/lib/Socket/messages-recv.d.ts +192 -83
  102. package/lib/Socket/messages-recv.d.ts.map +1 -0
  103. package/lib/Socket/messages-recv.js +1314 -559
  104. package/lib/Socket/messages-recv.js.map +1 -0
  105. package/lib/Socket/messages-send.d.ts +190 -75
  106. package/lib/Socket/messages-send.d.ts.map +1 -0
  107. package/lib/Socket/messages-send.js +937 -581
  108. package/lib/Socket/messages-send.js.map +1 -0
  109. package/lib/Socket/mex.d.ts +4 -0
  110. package/lib/Socket/mex.d.ts.map +1 -0
  111. package/lib/Socket/mex.js +62 -0
  112. package/lib/Socket/mex.js.map +1 -0
  113. package/lib/Socket/newsletter.d.ts +129 -73
  114. package/lib/Socket/newsletter.d.ts.map +1 -0
  115. package/lib/Socket/newsletter.js +373 -222
  116. package/lib/Socket/newsletter.js.map +1 -0
  117. package/lib/Socket/smgss.d.ts +119 -0
  118. package/lib/Socket/smgss.d.ts.map +1 -0
  119. package/lib/Socket/smgss.js +453 -0
  120. package/lib/Socket/smgss.js.map +1 -0
  121. package/lib/Socket/socket.d.ts +59 -270
  122. package/lib/Socket/socket.d.ts.map +1 -0
  123. package/lib/Socket/socket.js +738 -326
  124. package/lib/Socket/socket.js.map +1 -0
  125. package/lib/Store/index.d.ts +4 -2
  126. package/lib/Store/index.d.ts.map +1 -0
  127. package/lib/Store/index.js +4 -8
  128. package/lib/Store/index.js.map +1 -0
  129. package/lib/Store/make-in-memory-store.d.ts +74 -60
  130. package/lib/Store/make-in-memory-store.d.ts.map +1 -0
  131. package/lib/Store/make-in-memory-store.js +130 -119
  132. package/lib/Store/make-in-memory-store.js.map +1 -0
  133. package/lib/Store/make-ordered-dictionary.d.ts +4 -3
  134. package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
  135. package/lib/Store/make-ordered-dictionary.js +5 -6
  136. package/lib/Store/make-ordered-dictionary.js.map +1 -0
  137. package/lib/Store/object-repository.d.ts +6 -3
  138. package/lib/Store/object-repository.d.ts.map +1 -0
  139. package/lib/Store/object-repository.js +2 -5
  140. package/lib/Store/object-repository.js.map +1 -0
  141. package/lib/Types/Auth.d.ts +19 -5
  142. package/lib/Types/Auth.d.ts.map +1 -0
  143. package/lib/Types/Auth.js +2 -2
  144. package/lib/Types/Auth.js.map +1 -0
  145. package/lib/Types/Bussines.d.ts +25 -0
  146. package/lib/Types/Bussines.d.ts.map +1 -0
  147. package/lib/Types/Bussines.js +2 -0
  148. package/lib/Types/Bussines.js.map +1 -0
  149. package/lib/Types/Call.d.ts +3 -1
  150. package/lib/Types/Call.d.ts.map +1 -0
  151. package/lib/Types/Call.js +2 -2
  152. package/lib/Types/Call.js.map +1 -0
  153. package/lib/Types/Chat.d.ts +24 -9
  154. package/lib/Types/Chat.d.ts.map +1 -0
  155. package/lib/Types/Chat.js +8 -4
  156. package/lib/Types/Chat.js.map +1 -0
  157. package/lib/Types/Contact.d.ts +7 -4
  158. package/lib/Types/Contact.d.ts.map +1 -0
  159. package/lib/Types/Contact.js +2 -2
  160. package/lib/Types/Contact.js.map +1 -0
  161. package/lib/Types/Events.d.ts +90 -33
  162. package/lib/Types/Events.d.ts.map +1 -0
  163. package/lib/Types/Events.js +2 -2
  164. package/lib/Types/Events.js.map +1 -0
  165. package/lib/Types/GroupMetadata.d.ts +16 -9
  166. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  167. package/lib/Types/GroupMetadata.js +2 -2
  168. package/lib/Types/GroupMetadata.js.map +1 -0
  169. package/lib/Types/Label.d.ts +12 -0
  170. package/lib/Types/Label.d.ts.map +1 -0
  171. package/lib/Types/Label.js +3 -5
  172. package/lib/Types/Label.js.map +1 -0
  173. package/lib/Types/LabelAssociation.d.ts +1 -0
  174. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  175. package/lib/Types/LabelAssociation.js +3 -5
  176. package/lib/Types/LabelAssociation.js.map +1 -0
  177. package/lib/Types/Message.d.ts +176 -148
  178. package/lib/Types/Message.d.ts.map +1 -0
  179. package/lib/Types/Message.js +15 -7
  180. package/lib/Types/Message.js.map +1 -0
  181. package/lib/Types/Mex.d.ts +154 -0
  182. package/lib/Types/Mex.d.ts.map +1 -0
  183. package/lib/Types/Mex.js +39 -0
  184. package/lib/Types/Mex.js.map +1 -0
  185. package/lib/Types/Product.d.ts +2 -1
  186. package/lib/Types/Product.d.ts.map +1 -0
  187. package/lib/Types/Product.js +2 -2
  188. package/lib/Types/Product.js.map +1 -0
  189. package/lib/Types/Signal.d.ts +32 -2
  190. package/lib/Types/Signal.d.ts.map +1 -0
  191. package/lib/Types/Signal.js +2 -2
  192. package/lib/Types/Signal.js.map +1 -0
  193. package/lib/Types/Socket.d.ts +46 -20
  194. package/lib/Types/Socket.d.ts.map +1 -0
  195. package/lib/Types/Socket.js +3 -2
  196. package/lib/Types/Socket.js.map +1 -0
  197. package/lib/Types/State.d.ts +79 -2
  198. package/lib/Types/State.d.ts.map +1 -0
  199. package/lib/Types/State.js +56 -2
  200. package/lib/Types/State.js.map +1 -0
  201. package/lib/Types/USync.d.ts +3 -2
  202. package/lib/Types/USync.d.ts.map +1 -0
  203. package/lib/Types/USync.js +2 -2
  204. package/lib/Types/USync.js.map +1 -0
  205. package/lib/Types/index.d.ts +16 -14
  206. package/lib/Types/index.d.ts.map +1 -0
  207. package/lib/Types/index.js +15 -31
  208. package/lib/Types/index.js.map +1 -0
  209. package/lib/Utils/auth-utils.d.ts +10 -4
  210. package/lib/Utils/auth-utils.d.ts.map +1 -0
  211. package/lib/Utils/auth-utils.js +242 -151
  212. package/lib/Utils/auth-utils.js.map +1 -0
  213. package/lib/Utils/browser-utils.d.ts +4 -0
  214. package/lib/Utils/browser-utils.d.ts.map +1 -0
  215. package/lib/Utils/browser-utils.js +29 -0
  216. package/lib/Utils/browser-utils.js.map +1 -0
  217. package/lib/Utils/business.d.ts +3 -2
  218. package/lib/Utils/business.d.ts.map +1 -0
  219. package/lib/Utils/business.js +66 -69
  220. package/lib/Utils/business.js.map +1 -0
  221. package/lib/Utils/button-handler.d.ts +28 -0
  222. package/lib/Utils/button-handler.d.ts.map +1 -0
  223. package/lib/Utils/button-handler.js +79 -90
  224. package/lib/Utils/button-handler.js.map +1 -0
  225. package/lib/Utils/chat-utils.d.ts +42 -12
  226. package/lib/Utils/chat-utils.d.ts.map +1 -0
  227. package/lib/Utils/chat-utils.js +380 -238
  228. package/lib/Utils/chat-utils.js.map +1 -0
  229. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  230. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  231. package/lib/Utils/companion-reg-client-utils.js +35 -0
  232. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  233. package/lib/Utils/crypto.d.ts +11 -14
  234. package/lib/Utils/crypto.d.ts.map +1 -0
  235. package/lib/Utils/crypto.js +41 -116
  236. package/lib/Utils/crypto.js.map +1 -0
  237. package/lib/Utils/decode-wa-message.d.ts +36 -5
  238. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  239. package/lib/Utils/decode-wa-message.js +173 -63
  240. package/lib/Utils/decode-wa-message.js.map +1 -0
  241. package/lib/Utils/event-buffer.d.ts +8 -7
  242. package/lib/Utils/event-buffer.d.ts.map +1 -0
  243. package/lib/Utils/event-buffer.js +174 -70
  244. package/lib/Utils/event-buffer.js.map +1 -0
  245. package/lib/Utils/generics.d.ts +20 -17
  246. package/lib/Utils/generics.d.ts.map +1 -0
  247. package/lib/Utils/generics.js +159 -207
  248. package/lib/Utils/generics.js.map +1 -0
  249. package/lib/Utils/history.d.ts +16 -11
  250. package/lib/Utils/history.d.ts.map +1 -0
  251. package/lib/Utils/history.js +93 -53
  252. package/lib/Utils/history.js.map +1 -0
  253. package/lib/Utils/identity-change-handler.d.ts +44 -0
  254. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  255. package/lib/Utils/identity-change-handler.js +50 -0
  256. package/lib/Utils/identity-change-handler.js.map +1 -0
  257. package/lib/Utils/index.d.ts +30 -18
  258. package/lib/Utils/index.d.ts.map +1 -0
  259. package/lib/Utils/index.js +30 -34
  260. package/lib/Utils/index.js.map +1 -0
  261. package/lib/Utils/interactive.d.ts +60 -0
  262. package/lib/Utils/interactive.d.ts.map +1 -0
  263. package/lib/Utils/interactive.js +87 -117
  264. package/lib/Utils/interactive.js.map +1 -0
  265. package/lib/Utils/link-preview.d.ts +4 -4
  266. package/lib/Utils/link-preview.d.ts.map +1 -0
  267. package/lib/Utils/link-preview.js +17 -58
  268. package/lib/Utils/link-preview.js.map +1 -0
  269. package/lib/Utils/logger.d.ts +8 -6
  270. package/lib/Utils/logger.d.ts.map +1 -0
  271. package/lib/Utils/logger.js +3 -10
  272. package/lib/Utils/logger.js.map +1 -0
  273. package/lib/Utils/lt-hash.d.ts +8 -12
  274. package/lib/Utils/lt-hash.d.ts.map +1 -0
  275. package/lib/Utils/lt-hash.js +3 -46
  276. package/lib/Utils/lt-hash.js.map +1 -0
  277. package/lib/Utils/make-mutex.d.ts +2 -0
  278. package/lib/Utils/make-mutex.d.ts.map +1 -0
  279. package/lib/Utils/make-mutex.js +24 -34
  280. package/lib/Utils/make-mutex.js.map +1 -0
  281. package/lib/Utils/message-composer.d.ts +93 -0
  282. package/lib/Utils/message-composer.d.ts.map +1 -0
  283. package/lib/Utils/message-composer.js +311 -0
  284. package/lib/Utils/message-composer.js.map +1 -0
  285. package/lib/Utils/message-retry-manager.d.ts +115 -0
  286. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  287. package/lib/Utils/message-retry-manager.js +265 -0
  288. package/lib/Utils/message-retry-manager.js.map +1 -0
  289. package/lib/Utils/messages-media.d.ts +82 -40
  290. package/lib/Utils/messages-media.d.ts.map +1 -0
  291. package/lib/Utils/messages-media.js +674 -677
  292. package/lib/Utils/messages-media.js.map +1 -0
  293. package/lib/Utils/messages-newsletter.d.ts +74 -0
  294. package/lib/Utils/messages-newsletter.d.ts.map +1 -0
  295. package/lib/Utils/messages-newsletter.js +128 -0
  296. package/lib/Utils/messages-newsletter.js.map +1 -0
  297. package/lib/Utils/messages.d.ts +38 -14
  298. package/lib/Utils/messages.d.ts.map +1 -0
  299. package/lib/Utils/messages.js +835 -602
  300. package/lib/Utils/messages.js.map +1 -0
  301. package/lib/Utils/noise-handler.d.ts +9 -8
  302. package/lib/Utils/noise-handler.d.ts.map +1 -0
  303. package/lib/Utils/noise-handler.js +149 -98
  304. package/lib/Utils/noise-handler.js.map +1 -0
  305. package/lib/Utils/offline-node-processor.d.ts +17 -0
  306. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  307. package/lib/Utils/offline-node-processor.js +40 -0
  308. package/lib/Utils/offline-node-processor.js.map +1 -0
  309. package/lib/Utils/pre-key-manager.d.ts +28 -0
  310. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  311. package/lib/Utils/pre-key-manager.js +106 -0
  312. package/lib/Utils/pre-key-manager.js.map +1 -0
  313. package/lib/Utils/process-message.d.ts +30 -12
  314. package/lib/Utils/process-message.d.ts.map +1 -0
  315. package/lib/Utils/process-message.js +438 -230
  316. package/lib/Utils/process-message.js.map +1 -0
  317. package/lib/Utils/reporting-utils.d.ts +11 -0
  318. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  319. package/lib/Utils/reporting-utils.js +258 -0
  320. package/lib/Utils/reporting-utils.js.map +1 -0
  321. package/lib/Utils/shortcake-crypto.d.ts +36 -0
  322. package/lib/Utils/shortcake-crypto.d.ts.map +1 -0
  323. package/lib/Utils/shortcake-crypto.js +71 -0
  324. package/lib/Utils/shortcake-crypto.js.map +1 -0
  325. package/lib/Utils/shortcake.d.ts +36 -0
  326. package/lib/Utils/shortcake.d.ts.map +1 -0
  327. package/lib/Utils/shortcake.js +162 -0
  328. package/lib/Utils/shortcake.js.map +1 -0
  329. package/lib/Utils/signal.d.ts +20 -6
  330. package/lib/Utils/signal.d.ts.map +1 -0
  331. package/lib/Utils/signal.js +112 -64
  332. package/lib/Utils/signal.js.map +1 -0
  333. package/lib/Utils/stanza-ack.d.ts +11 -0
  334. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  335. package/lib/Utils/stanza-ack.js +38 -0
  336. package/lib/Utils/stanza-ack.js.map +1 -0
  337. package/lib/Utils/sync-action-utils.d.ts +19 -0
  338. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  339. package/lib/Utils/sync-action-utils.js +49 -0
  340. package/lib/Utils/sync-action-utils.js.map +1 -0
  341. package/lib/Utils/tc-token-utils.d.ts +37 -0
  342. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  343. package/lib/Utils/tc-token-utils.js +164 -0
  344. package/lib/Utils/tc-token-utils.js.map +1 -0
  345. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
  346. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  347. package/lib/Utils/use-multi-file-auth-state.js +40 -64
  348. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  349. package/lib/Utils/use-single-file-auth-state.d.ts +6 -0
  350. package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
  351. package/lib/Utils/use-single-file-auth-state.js +111 -0
  352. package/lib/Utils/use-single-file-auth-state.js.map +1 -0
  353. package/lib/Utils/use-sqlite-auth-state.d.ts +14 -0
  354. package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
  355. package/lib/Utils/use-sqlite-auth-state.js +107 -0
  356. package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
  357. package/lib/Utils/validate-connection.d.ts +5 -3
  358. package/lib/Utils/validate-connection.d.ts.map +1 -0
  359. package/lib/Utils/validate-connection.js +82 -101
  360. package/lib/Utils/validate-connection.js.map +1 -0
  361. package/lib/WABinary/constants.d.ts +1 -0
  362. package/lib/WABinary/constants.d.ts.map +1 -0
  363. package/lib/WABinary/constants.js +10 -12
  364. package/lib/WABinary/constants.js.map +1 -0
  365. package/lib/WABinary/decode.d.ts +2 -1
  366. package/lib/WABinary/decode.d.ts.map +1 -0
  367. package/lib/WABinary/decode.js +49 -52
  368. package/lib/WABinary/decode.js.map +1 -0
  369. package/lib/WABinary/encode.d.ts +2 -1
  370. package/lib/WABinary/encode.d.ts.map +1 -0
  371. package/lib/WABinary/encode.js +19 -49
  372. package/lib/WABinary/encode.js.map +1 -0
  373. package/lib/WABinary/generic-utils.d.ts +5 -4
  374. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  375. package/lib/WABinary/generic-utils.js +46 -43
  376. package/lib/WABinary/generic-utils.js.map +1 -0
  377. package/lib/WABinary/index.d.ts +6 -5
  378. package/lib/WABinary/index.d.ts.map +1 -0
  379. package/lib/WABinary/index.js +6 -21
  380. package/lib/WABinary/index.js.map +1 -0
  381. package/lib/WABinary/jid-utils.d.ts +32 -10
  382. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  383. package/lib/WABinary/jid-utils.js +103 -59
  384. package/lib/WABinary/jid-utils.js.map +1 -0
  385. package/lib/WABinary/types.d.ts +2 -1
  386. package/lib/WABinary/types.d.ts.map +1 -0
  387. package/lib/WABinary/types.js +2 -2
  388. package/lib/WABinary/types.js.map +1 -0
  389. package/lib/WAM/BinaryInfo.d.ts +2 -1
  390. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  391. package/lib/WAM/BinaryInfo.js +2 -5
  392. package/lib/WAM/BinaryInfo.js.map +1 -0
  393. package/lib/WAM/constants.d.ts +5 -3
  394. package/lib/WAM/constants.d.ts.map +1 -0
  395. package/lib/WAM/constants.js +19071 -11568
  396. package/lib/WAM/constants.js.map +1 -0
  397. package/lib/WAM/encode.d.ts +2 -1
  398. package/lib/WAM/encode.d.ts.map +1 -0
  399. package/lib/WAM/encode.js +17 -22
  400. package/lib/WAM/encode.js.map +1 -0
  401. package/lib/WAM/index.d.ts +4 -3
  402. package/lib/WAM/index.d.ts.map +1 -0
  403. package/lib/WAM/index.js +4 -19
  404. package/lib/WAM/index.js.map +1 -0
  405. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +4 -3
  406. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  407. package/lib/WAUSync/Protocols/USyncContactProtocol.js +33 -13
  408. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  409. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +3 -2
  410. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  411. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -14
  412. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  413. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +3 -2
  414. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  415. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +8 -11
  416. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  417. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +3 -2
  418. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  419. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -13
  420. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  421. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  422. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  423. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  424. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  425. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +4 -3
  426. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  427. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -22
  428. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  429. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +5 -3
  430. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  431. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -8
  432. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  433. package/lib/WAUSync/Protocols/index.d.ts +6 -4
  434. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  435. package/lib/WAUSync/Protocols/index.js +6 -20
  436. package/lib/WAUSync/Protocols/index.js.map +1 -0
  437. package/lib/WAUSync/USyncQuery.d.ts +6 -4
  438. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  439. package/lib/WAUSync/USyncQuery.js +44 -35
  440. package/lib/WAUSync/USyncQuery.js.map +1 -0
  441. package/lib/WAUSync/USyncUser.d.ts +10 -5
  442. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  443. package/lib/WAUSync/USyncUser.js +10 -5
  444. package/lib/WAUSync/USyncUser.js.map +1 -0
  445. package/lib/WAUSync/index.d.ts +4 -3
  446. package/lib/WAUSync/index.d.ts.map +1 -0
  447. package/lib/WAUSync/index.js +4 -19
  448. package/lib/WAUSync/index.js.map +1 -0
  449. package/lib/index.d.ts +12 -15
  450. package/lib/index.d.ts.map +1 -0
  451. package/lib/index.js +15 -48
  452. package/lib/index.js.map +1 -0
  453. package/package.json +44 -64
  454. package/WAProto/index.ts.ts +0 -53473
  455. package/WAProto/n +0 -1
  456. package/lib/Baileys.jpeg +0 -0
  457. package/lib/Defaults/baileys-version.json +0 -3
  458. package/lib/Defaults/n +0 -1
  459. package/lib/Signal/Group/queue-job.d.ts +0 -1
  460. package/lib/Signal/Group/queue-job.js +0 -57
  461. package/lib/Signal/n +0 -1
  462. package/lib/Socket/Client/n +0 -1
  463. package/lib/Socket/n +0 -1
  464. package/lib/Socket/setup.js +0 -480
  465. package/lib/Socket/setup.ts +0 -622
  466. package/lib/Socket/usync.d.ts +0 -36
  467. package/lib/Socket/usync.js +0 -70
  468. package/lib/Store/n +0 -1
  469. package/lib/Types/Newsletter.d.ts +0 -79
  470. package/lib/Types/Newsletter.js +0 -18
  471. package/lib/Types/n +0 -1
  472. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  473. package/lib/Utils/baileys-event-stream.js +0 -63
  474. package/lib/Utils/error-handler.js +0 -37
  475. package/lib/Utils/n +0 -1
  476. package/lib/WABinary/jid-utils.js.bak +0 -83
  477. package/lib/WABinary/n +0 -1
  478. package/lib/WAM/n +0 -1
  479. package/lib/WAUSync/Protocols/n +0 -1
  480. package/lib/WAUSync/n +0 -1
  481. package/lib/n +0 -1
@@ -1,622 +0,0 @@
1
- const WAProto = require('../../WAProto').proto;
2
- const crypto = require('crypto');
3
- const Utils_1 = require("../Utils");
4
-
5
- class yaoii {
6
- constructor(utils, waUploadToServer, relayMessageFn) {
7
- this.utils = utils;
8
- this.relayMessage = relayMessageFn
9
- this.waUploadToServer = waUploadToServer;
10
- this.bail = {
11
- generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
12
- generateMessageID: Utils_1.generateMessageID,
13
- getContentType: (msg) => Object.keys(msg.message || {})[0]
14
- };
15
- }
16
-
17
- detectType(content) {
18
- if (content.requestPaymentMessage) return 'PAYMENT';
19
- if (content.productMessage) return 'PRODUCT';
20
- if (content.interactiveMessage) return 'INTERACTIVE';
21
- if (content.albumMessage) return 'ALBUM';
22
- if (content.eventMessage) return 'EVENT';
23
- if (content.pollResultMessage) return 'POLL_RESULT';
24
- if (content.listMessage) return 'LIST';
25
- if (content.groupStatusMessage) return 'GROUP_STORY';
26
- if (content.groupStoryMessage) return 'GROUP_STORY';
27
- return null;
28
- }
29
-
30
- async handlePayment(content, quoted) {
31
- const data = content.requestPaymentMessage;
32
- let notes = {};
33
-
34
- if (data.sticker?.stickerMessage) {
35
- notes = {
36
- stickerMessage: {
37
- ...data.sticker.stickerMessage,
38
- contextInfo: {
39
- stanzaId: quoted?.key?.id,
40
- participant: quoted?.key?.participant || content.sender,
41
- quotedMessage: quoted?.message
42
- }
43
- }
44
- };
45
- } else if (data.note) {
46
- notes = {
47
- extendedTextMessage: {
48
- text: data.note,
49
- contextInfo: {
50
- stanzaId: quoted?.key?.id,
51
- participant: quoted?.key?.participant || content.sender,
52
- quotedMessage: quoted?.message
53
- }
54
- }
55
- };
56
- }
57
-
58
- return {
59
- requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
60
- expiryTimestamp: data.expiry || 0,
61
- amount1000: data.amount || 0,
62
- currencyCodeIso4217: data.currency || "IDR",
63
- requestFrom: data.from || "0@s.whatsapp.net",
64
- noteMessage: notes,
65
- background: data.background ?? {
66
- id: "DEFAULT",
67
- placeholderArgb: 0xFFF0F0F0
68
- }
69
- })
70
- };
71
- }
72
-
73
- async handleProduct(content, jid, quoted) {
74
- const {
75
- title,
76
- description,
77
- thumbnail,
78
- productId,
79
- retailerId,
80
- url,
81
- body = "",
82
- footer = "",
83
- buttons = [],
84
- priceAmount1000 = null,
85
- currencyCode = "IDR"
86
- } = content.productMessage;
87
-
88
- let productImage;
89
-
90
- if (Buffer.isBuffer(thumbnail)) {
91
- const { imageMessage } = await this.utils.generateWAMessageContent(
92
- { image: thumbnail },
93
- { upload: this.waUploadToServer }
94
- );
95
- productImage = imageMessage;
96
- } else if (typeof thumbnail === 'object' && thumbnail.url) {
97
- const { imageMessage } = await this.utils.generateWAMessageContent(
98
- { image: { url: thumbnail.url }},
99
- { upload: this.waUploadToServer }
100
- );
101
- productImage = imageMessage;
102
- }
103
-
104
- return {
105
- viewOnceMessage: {
106
- message: {
107
- interactiveMessage: {
108
- body: { text: body },
109
- footer: { text: footer },
110
- header: {
111
- title,
112
- hasMediaAttachment: true,
113
- productMessage: {
114
- product: {
115
- productImage,
116
- productId,
117
- title,
118
- description,
119
- currencyCode,
120
- priceAmount1000,
121
- retailerId,
122
- url,
123
- productImageCount: 1
124
- },
125
- businessOwnerJid: "0@s.whatsapp.net"
126
- }
127
- },
128
- nativeFlowMessage: { buttons }
129
- }
130
- }
131
- }
132
- };
133
- }
134
-
135
- async handleInteractive(content, jid, quoted) {
136
- const {
137
- title,
138
- footer,
139
- thumbnail,
140
- image,
141
- video,
142
- document,
143
- mimetype,
144
- fileName,
145
- jpegThumbnail,
146
- contextInfo,
147
- externalAdReply,
148
- buttons = [],
149
- nativeFlowMessage,
150
- header
151
- } = content.interactiveMessage;
152
-
153
- let media = null;
154
- let mediaType = null;
155
-
156
- const getMediaPayload = (mediaData, type) => {
157
- if (typeof mediaData === 'object' && mediaData.url) {
158
- return { [type]: { url: mediaData.url } };
159
- }
160
- return { [type]: mediaData };
161
- };
162
-
163
- if (thumbnail) {
164
- media = await this.utils.prepareWAMessageMedia(
165
- getMediaPayload(thumbnail, 'image'),
166
- { upload: this.waUploadToServer }
167
- );
168
- mediaType = 'image';
169
- } else if (image) {
170
- media = await this.utils.prepareWAMessageMedia(
171
- getMediaPayload(image, 'image'),
172
- { upload: this.waUploadToServer }
173
- );
174
- mediaType = 'image';
175
- } else if (video) {
176
- media = await this.utils.prepareWAMessageMedia(
177
- getMediaPayload(video, 'video'),
178
- { upload: this.waUploadToServer }
179
- );
180
- mediaType = 'video';
181
- } else if (document) {
182
- let documentPayload = getMediaPayload(document, 'document');
183
-
184
- if (jpegThumbnail) {
185
- documentPayload.jpegThumbnail = jpegThumbnail;
186
- }
187
-
188
- media = await this.utils.prepareWAMessageMedia(
189
- documentPayload,
190
- { upload: this.waUploadToServer }
191
- );
192
-
193
- if (fileName) {
194
- media.documentMessage.fileName = fileName;
195
- }
196
- if (mimetype) {
197
- media.documentMessage.mimetype = mimetype;
198
- }
199
- mediaType = 'document';
200
- }
201
-
202
- let interactiveMessage = {
203
- body: { text: title || "" },
204
- footer: { text: footer || "" }
205
- };
206
-
207
- if (buttons && buttons.length > 0) {
208
- interactiveMessage.nativeFlowMessage = {
209
- buttons: buttons
210
- };
211
-
212
- if (nativeFlowMessage) {
213
- interactiveMessage.nativeFlowMessage = {
214
- ...interactiveMessage.nativeFlowMessage,
215
- ...nativeFlowMessage
216
- };
217
- }
218
- } else if (nativeFlowMessage) {
219
- interactiveMessage.nativeFlowMessage = nativeFlowMessage;
220
- }
221
-
222
- if (media) {
223
- interactiveMessage.header = {
224
- title: header || "",
225
- hasMediaAttachment: true,
226
- ...media
227
- };
228
- } else {
229
- interactiveMessage.header = {
230
- title: header || "",
231
- hasMediaAttachment: false
232
- };
233
- }
234
-
235
- let finalContextInfo = {};
236
-
237
- const inputContextInfo = contextInfo || {};
238
- if (quoted) {
239
- inputContextInfo.stanzaId = quoted.key.id;
240
- inputContextInfo.participant = quoted.key.participant || quoted.key.remoteJid;
241
- inputContextInfo.quotedMessage = quoted.message;
242
- }
243
-
244
- if (Object.keys(inputContextInfo).length > 0) {
245
- finalContextInfo = {
246
- mentionedJid: inputContextInfo.mentionedJid || [],
247
- forwardingScore: inputContextInfo.forwardingScore || 0,
248
- isForwarded: inputContextInfo.isForwarded || false,
249
- ...inputContextInfo
250
- };
251
- }
252
-
253
- if (externalAdReply) {
254
- finalContextInfo.externalAdReply = {
255
- title: externalAdReply.title || "",
256
- body: externalAdReply.body || "",
257
- mediaType: externalAdReply.mediaType || 1,
258
- thumbnailUrl: externalAdReply.thumbnailUrl || "",
259
- mediaUrl: externalAdReply.mediaUrl || "",
260
- sourceUrl: externalAdReply.sourceUrl || "",
261
- showAdAttribution: externalAdReply.showAdAttribution || false,
262
- renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
263
- ...externalAdReply
264
- };
265
- }
266
-
267
- if (Object.keys(finalContextInfo).length > 0) {
268
- interactiveMessage.contextInfo = finalContextInfo;
269
- }
270
-
271
- return {
272
- interactiveMessage: interactiveMessage
273
- };
274
- }
275
-
276
- async handleAlbum(content, jid, quoted) {
277
- const array = content.albumMessage;
278
- const album = await this.utils.generateWAMessageFromContent(jid, {
279
- messageContextInfo: {
280
- messageSecret: crypto.randomBytes(32),
281
- },
282
- albumMessage: {
283
- expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
284
- expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
285
- },
286
- }, {
287
- userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
288
- quoted,
289
- upload: this.waUploadToServer
290
- });
291
-
292
- await this.relayMessage(jid, album.message, {
293
- messageId: album.key.id,
294
- });
295
-
296
- for (let content of array) {
297
- const img = await this.utils.generateWAMessage(jid, content, {
298
- upload: this.waUploadToServer,
299
- });
300
-
301
- img.message.messageContextInfo = {
302
- messageSecret: crypto.randomBytes(32),
303
- messageAssociation: {
304
- associationType: 1,
305
- parentMessageKey: album.key,
306
- },
307
- participant: "0@s.whatsapp.net",
308
- remoteJid: "status@broadcast",
309
- forwardingScore: 99999,
310
- isForwarded: true,
311
- mentionedJid: [jid],
312
- starred: true,
313
- labels: ["Y", "Important"],
314
- isHighlighted: true,
315
- businessMessageForwardInfo: {
316
- businessOwnerJid: jid,
317
- },
318
- dataSharingContext: {
319
- showMmDisclosure: true,
320
- },
321
- };
322
-
323
- img.message.forwardedNewsletterMessageInfo = {
324
- newsletterJid: "0@newsletter",
325
- serverMessageId: 1,
326
- newsletterName: `WhatsApp`,
327
- contentType: 1,
328
- timestamp: new Date().toISOString(),
329
- senderName: "Asta",
330
- content: "Text Message",
331
- priority: "high",
332
- status: "sent",
333
- };
334
-
335
- img.message.disappearingMode = {
336
- initiator: 3,
337
- trigger: 4,
338
- initiatorDeviceJid: jid,
339
- initiatedByExternalService: true,
340
- initiatedByUserDevice: true,
341
- initiatedBySystem: true,
342
- initiatedByServer: true,
343
- initiatedByAdmin: true,
344
- initiatedByUser: true,
345
- initiatedByApp: true,
346
- initiatedByBot: true,
347
- initiatedByMe: true,
348
- };
349
-
350
- await this.relayMessage(jid, img.message, {
351
- messageId: img.key.id,
352
- quoted: {
353
- key: {
354
- remoteJid: album.key.remoteJid,
355
- id: album.key.id,
356
- fromMe: true,
357
- participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
358
- },
359
- message: album.message,
360
- },
361
- });
362
- }
363
- return album;
364
- }
365
-
366
- async handleEvent(content, jid, quoted) {
367
- const eventData = content.eventMessage;
368
-
369
- const msg = await this.utils.generateWAMessageFromContent(jid, {
370
- viewOnceMessage: {
371
- message: {
372
- messageContextInfo: {
373
- deviceListMetadata: {},
374
- deviceListMetadataVersion: 2,
375
- messageSecret: crypto.randomBytes(32),
376
- supportPayload: JSON.stringify({
377
- version: 2,
378
- is_ai_message: true,
379
- should_show_system_message: true,
380
- ticket_id: crypto.randomBytes(16).toString('hex')
381
- })
382
- },
383
- eventMessage: {
384
- contextInfo: {
385
- mentionedJid: [jid],
386
- participant: jid,
387
- remoteJid: "status@broadcast",
388
- forwardedNewsletterMessageInfo: {
389
- newsletterName: "Asta",
390
- newsletterJid: "120363399175402285@newsletter",
391
- serverMessageId: 1
392
- },
393
- ...(quoted ? {
394
- stanzaId: quoted.key.id,
395
- participant: quoted.key.participant || quoted.key.remoteJid,
396
- quotedMessage: quoted.message
397
- } : {})
398
- },
399
- isCanceled: eventData.isCanceled || false,
400
- name: eventData.name,
401
- description: eventData.description,
402
- location: eventData.location || {
403
- degreesLatitude: 0,
404
- degreesLongitude: 0,
405
- name: "Location"
406
- },
407
- joinLink: eventData.joinLink || '',
408
- startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
409
- endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
410
- extraGuestsAllowed: eventData.extraGuestsAllowed !== false
411
- }
412
- }
413
- }
414
- }, { quoted });
415
-
416
- await this.relayMessage(jid, msg.message, {
417
- messageId: msg.key.id
418
- });
419
- return msg;
420
- }
421
-
422
- async handlePollResult(content, jid, quoted) {
423
- const pollData = content.pollResultMessage;
424
-
425
- const msg = await this.utils.generateWAMessageFromContent(jid, {
426
- pollResultSnapshotMessage: {
427
- name: pollData.name,
428
- pollVotes: pollData.pollVotes.map(vote => ({
429
- optionName: vote.optionName,
430
- optionVoteCount: typeof vote.optionVoteCount === 'number'
431
- ? vote.optionVoteCount.toString()
432
- : vote.optionVoteCount
433
- }))
434
- }
435
- }, {
436
- userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
437
- quoted
438
- });
439
-
440
- await this.relayMessage(jid, msg.message, {
441
- messageId: msg.key.id
442
- });
443
-
444
- return msg;
445
- }
446
-
447
- async handleList(content, jid, quoted) {
448
- const data = content.listMessage;
449
-
450
- const listMessagePayload = WAProto.Message.ListMessage.fromObject({
451
- title: data.title || '',
452
- description: data.description || '',
453
- buttonText: data.buttonText || 'Pilih',
454
- sections: data.sections.map(section => ({
455
- title: section.title,
456
- rows: section.rows.map(row => ({
457
- rowId: row.rowId || this.utils.generateMessageID(),
458
- title: row.title,
459
- description: row.description || ''
460
- }))
461
- })),
462
- listType: data.listType || 1,
463
- footerText: data.footer || ''
464
- });
465
-
466
- const listContent = {
467
- listMessage: listMessagePayload
468
- };
469
-
470
- const contextInfo = data.contextInfo || {};
471
-
472
- if (quoted) {
473
- contextInfo.stanzaId = quoted.key.id;
474
- contextInfo.participant = quoted.key.participant || quoted.key.remoteJid;
475
- contextInfo.quotedMessage = quoted.message;
476
- }
477
-
478
- if (Object.keys(contextInfo).length > 0) {
479
- listContent.listMessage.contextInfo = contextInfo;
480
- }
481
-
482
- const msg = await this.utils.generateWAMessageFromContent(
483
- jid,
484
- listContent,
485
- { quoted }
486
- );
487
-
488
- await this.relayMessage(jid, msg.message, { messageId: msg.key.id });
489
-
490
- return msg;
491
- }
492
-
493
- async handleGroupStory(content, jid, quoted) {
494
- if (content.groupStatusMessage) {
495
- const storyData = content.groupStatusMessage;
496
- let waMsgContent;
497
-
498
- if (storyData.message) {
499
- waMsgContent = storyData;
500
- } else {
501
- if (typeof this.bail?.generateWAMessageContent === "function") {
502
- waMsgContent = await this.bail.generateWAMessageContent(storyData, {
503
- upload: this.waUploadToServer
504
- });
505
- } else if (typeof this.utils?.generateWAMessageContent === "function") {
506
- waMsgContent = await this.utils.generateWAMessageContent(storyData, {
507
- upload: this.waUploadToServer
508
- });
509
- } else if (typeof this.utils?.prepareMessageContent === "function") {
510
- waMsgContent = await this.utils.prepareMessageContent(storyData, {
511
- upload: this.waUploadToServer
512
- });
513
- } else {
514
- waMsgContent = await Utils_1.generateWAMessageContent(storyData, {
515
- upload: this.waUploadToServer
516
- });
517
- }
518
- }
519
-
520
- let msg = {
521
- message: {
522
- groupStatusMessageV2: {
523
- message: waMsgContent.message || waMsgContent
524
- }
525
- }
526
- };
527
-
528
- return await this.relayMessage(jid, msg.message, {
529
- messageId: this.bail.generateMessageID()
530
- });
531
-
532
- } else if (content.groupStoryMessage) {
533
- const { groupStoryMessage } = content;
534
-
535
- if (!this.utils.isJidGroup(jid)) {
536
- throw new Error("Group Story messages must be sent to a group JID.");
537
- }
538
-
539
- let mediaContent = {};
540
-
541
- if (groupStoryMessage.image || groupStoryMessage.video) {
542
- const mediaData = groupStoryMessage.image || groupStoryMessage.video;
543
- const mediaType = groupStoryMessage.image ? 'image' : 'video';
544
-
545
- let stream;
546
- if (Buffer.isBuffer(mediaData)) {
547
- stream = mediaData;
548
- } else if (typeof mediaData === 'object' && mediaData.url) {
549
- throw new Error("Group Story media from URL is not supported in this simplified handler. Use Buffer or fetch it first.");
550
- } else {
551
- stream = Buffer.from(mediaData, 'base64');
552
- }
553
-
554
- const upload = await this.waUploadToServer(stream, {
555
- mediaType: mediaType,
556
- });
557
-
558
- mediaContent = {
559
- [mediaType + 'Message']: {
560
- url: upload.url,
561
- mimetype: mediaType === 'image' ? 'image/jpeg' : 'video/mp4',
562
- caption: groupStoryMessage.caption,
563
- fileSha256: upload.fileSha256,
564
- fileEncSha256: upload.fileEncSha256,
565
- mediaKey: upload.mediaKey,
566
- fileLength: upload.fileLength,
567
- directPath: upload.directPath,
568
- mediaKeyTimestamp: this.utils.unixTimestampSeconds(),
569
- jpegThumbnail: groupStoryMessage.jpegThumbnail,
570
- }
571
- };
572
- } else if (groupStoryMessage.caption) {
573
- mediaContent = {
574
- extendedTextMessage: {
575
- text: groupStoryMessage.caption
576
- }
577
- };
578
- } else {
579
- throw new Error("Group Story content must contain image, video, or caption.");
580
- }
581
-
582
- const groupStatusMessageContent = {
583
- groupStatusMessage: {
584
- key: {
585
- remoteJid: jid,
586
- fromMe: true,
587
- id: this.utils.generateMessageID(),
588
- participant: this.utils.jidNormalizedUser(this.utils.auth.creds.me.id)
589
- },
590
- message: {
591
- ...mediaContent,
592
- contextInfo: {
593
- mentionedJid: groupStoryMessage.mentions || [],
594
- ...(quoted ? {
595
- stanzaId: quoted.key.id,
596
- participant: quoted.key.participant || quoted.key.remoteJid,
597
- quotedMessage: quoted.message
598
- } : {})
599
- }
600
- },
601
- }
602
- };
603
-
604
- const fullMsg = await this.utils.generateWAMessageFromContent(
605
- jid,
606
- groupStatusMessageContent,
607
- { quoted, logger: this.utils.logger }
608
- );
609
-
610
- await this.relayMessage(jid, fullMsg.message, {
611
- messageId: fullMsg.key.id,
612
- type: 'group_status',
613
- });
614
-
615
- return fullMsg;
616
- } else {
617
- throw new Error("Invalid content for handleGroupStory. Neither groupStatusMessage nor groupStoryMessage found.");
618
- }
619
- }
620
- }
621
-
622
- module.exports = yaoii;
@@ -1,36 +0,0 @@
1
- import { Boom } from '@hapi/boom';
2
- import { SocketConfig } from '../Types';
3
- import { BinaryNode } from '../WABinary';
4
- import { USyncQuery } from '../WAUSync';
5
- export declare const makeUSyncSocket: (config: SocketConfig) => {
6
- executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
7
- type: "md";
8
- ws: import("./Client").WebSocketClient;
9
- ev: import("../Types").BaileysEventEmitter & {
10
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
11
- buffer(): void;
12
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
13
- flush(force?: boolean): boolean;
14
- isBuffering(): boolean;
15
- };
16
- authState: {
17
- creds: import("../Types").AuthenticationCreds;
18
- keys: import("../Types").SignalKeyStoreWithTransaction;
19
- };
20
- signalRepository: import("../Types").SignalRepository;
21
- user: import("../Types").Contact | undefined;
22
- generateMessageTag: () => string;
23
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
24
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
25
- waitForSocketOpen: () => Promise<void>;
26
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
27
- sendNode: (frame: BinaryNode) => Promise<void>;
28
- logout: (msg?: string) => Promise<void>;
29
- end: (error: Error | undefined) => void;
30
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
31
- uploadPreKeys: (count?: number) => Promise<void>;
32
- uploadPreKeysToServerIfRequired: () => Promise<void>;
33
- requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
34
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
35
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
36
- };