@mrlegendbot/baileys 1.2.3 → 1.2.4

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 (212) hide show
  1. package/README.upstream.md +1312 -0
  2. package/WAProto/WAProto.json +1 -0
  3. package/WAProto/WAProto.proto +6275 -0
  4. package/WAProto/compiler.js +550 -0
  5. package/WAProto/index.js +2 -97691
  6. package/lib/Defaults/index.js +89 -92
  7. package/lib/Signal/Group/ciphertext-message.js +9 -10
  8. package/lib/Signal/Group/group-session-builder.js +21 -22
  9. package/lib/Signal/Group/group_cipher.js +75 -69
  10. package/lib/Signal/Group/index.js +0 -1
  11. package/lib/Signal/Group/keyhelper.js +9 -10
  12. package/lib/Signal/Group/sender-chain-key.js +21 -22
  13. package/lib/Signal/Group/sender-key-distribution-message.js +51 -60
  14. package/lib/Signal/Group/sender-key-message.js +56 -62
  15. package/lib/Signal/Group/sender-key-name.js +38 -40
  16. package/lib/Signal/Group/sender-key-record.js +33 -34
  17. package/lib/Signal/Group/sender-key-state.js +72 -76
  18. package/lib/Signal/Group/sender-message-key.js +22 -23
  19. package/lib/Signal/libsignal.js +506 -405
  20. package/lib/Signal/lid-mapping.js +276 -258
  21. package/lib/Socket/Client/index.js +0 -1
  22. package/lib/Socket/Client/types.js +6 -7
  23. package/lib/Socket/Client/websocket.js +48 -49
  24. package/lib/Socket/business.js +349 -369
  25. package/lib/Socket/chats.js +1172 -1148
  26. package/lib/Socket/communities.js +473 -413
  27. package/lib/Socket/groups.js +387 -331
  28. package/lib/Socket/index.js +6 -8
  29. package/lib/Socket/messages-recv.js +1782 -1719
  30. package/lib/Socket/messages-send.js +1503 -2450
  31. package/lib/Socket/mex.js +40 -35
  32. package/lib/Socket/newsletter.js +239 -191
  33. package/lib/Socket/socket.js +992 -923
  34. package/lib/Store/index.js +8 -0
  35. package/lib/Store/keyed-db.js +108 -0
  36. package/lib/Store/make-cache-manager-store.js +70 -0
  37. package/lib/Store/make-in-memory-store.js +417 -0
  38. package/lib/Store/make-ordered-dictionary.js +69 -0
  39. package/lib/Store/object-repository.js +27 -0
  40. package/lib/Types/Auth.js +0 -1
  41. package/lib/Types/Bussines.js +0 -1
  42. package/lib/Types/Call.js +0 -1
  43. package/lib/Types/Chat.js +1 -8
  44. package/lib/Types/Contact.js +0 -1
  45. package/lib/Types/Events.js +1 -2
  46. package/lib/Types/GroupMetadata.js +0 -1
  47. package/lib/Types/Label.js +20 -22
  48. package/lib/Types/LabelAssociation.js +2 -4
  49. package/lib/Types/Message.js +3 -5
  50. package/lib/Types/Mex.js +26 -31
  51. package/lib/Types/Product.js +0 -1
  52. package/lib/Types/Signal.js +1 -2
  53. package/lib/Types/Socket.js +2 -3
  54. package/lib/Types/State.js +4 -52
  55. package/lib/Types/USync.js +0 -1
  56. package/lib/Types/index.js +10 -11
  57. package/lib/Utils/auth-utils.js +240 -277
  58. package/lib/Utils/browser-utils.js +20 -23
  59. package/lib/Utils/business.js +200 -204
  60. package/lib/Utils/chat-utils.js +836 -810
  61. package/lib/Utils/companion-reg-client-utils.js +23 -25
  62. package/lib/Utils/crypto.js +70 -86
  63. package/lib/Utils/decode-wa-message.js +277 -284
  64. package/lib/Utils/event-buffer.js +592 -595
  65. package/lib/Utils/generics.js +312 -335
  66. package/lib/Utils/history.js +123 -115
  67. package/lib/Utils/index.js +1 -2
  68. package/lib/Utils/link-preview.js +74 -73
  69. package/lib/Utils/logger.js +3 -2
  70. package/lib/Utils/lt-hash.js +0 -6
  71. package/lib/Utils/make-mutex.js +27 -27
  72. package/lib/Utils/message-retry-manager.js +213 -254
  73. package/lib/Utils/messages-media.js +741 -715
  74. package/lib/Utils/messages.js +791 -827
  75. package/lib/Utils/noise-handler.js +215 -187
  76. package/lib/Utils/pre-key-manager.js +69 -98
  77. package/lib/Utils/process-message.js +617 -586
  78. package/lib/Utils/reporting-utils.js +553 -234
  79. package/lib/Utils/signal.js +217 -170
  80. package/lib/Utils/stanza-ack.js +27 -35
  81. package/lib/Utils/sync-action-utils.js +37 -41
  82. package/lib/Utils/tc-token-utils.js +120 -141
  83. package/lib/Utils/use-multi-file-auth-state.js +87 -105
  84. package/lib/Utils/use-sqlite-auth-state.js +162 -0
  85. package/lib/Utils/validate-connection.js +190 -188
  86. package/lib/WABinary/constants.js +28 -1294
  87. package/lib/WABinary/decode.js +245 -249
  88. package/lib/WABinary/encode.js +201 -206
  89. package/lib/WABinary/generic-utils.js +86 -89
  90. package/lib/WABinary/index.js +0 -1
  91. package/lib/WABinary/jid-utils.js +68 -77
  92. package/lib/WABinary/types.js +0 -1
  93. package/lib/WAM/BinaryInfo.js +7 -8
  94. package/lib/WAM/constants.js +19892 -22853
  95. package/lib/WAM/encode.js +121 -132
  96. package/lib/WAM/index.js +0 -1
  97. package/lib/WAUSync/Protocols/USyncContactProtocol.js +46 -43
  98. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +47 -48
  99. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +22 -23
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +30 -33
  101. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +19 -20
  102. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -44
  103. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -24
  104. package/lib/WAUSync/Protocols/index.js +0 -1
  105. package/lib/WAUSync/USyncQuery.js +79 -88
  106. package/lib/WAUSync/USyncUser.js +28 -29
  107. package/lib/WAUSync/index.js +0 -1
  108. package/lib/index.js +2 -2
  109. package/package.json +22 -86
  110. package/WAProto/GenerateStatics.sh +0 -3
  111. package/WAProto/fix-imports.js +0 -85
  112. package/WAProto/index.d.ts +0 -14017
  113. package/lib/Defaults/index.d.ts +0 -75
  114. package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
  115. package/lib/Signal/Group/group-session-builder.d.ts +0 -15
  116. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  117. package/lib/Signal/Group/index.d.ts +0 -12
  118. package/lib/Signal/Group/keyhelper.d.ts +0 -11
  119. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  120. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  121. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  122. package/lib/Signal/Group/sender-key-name.d.ts +0 -18
  123. package/lib/Signal/Group/sender-key-record.d.ts +0 -31
  124. package/lib/Signal/Group/sender-key-state.d.ts +0 -39
  125. package/lib/Signal/Group/sender-message-key.d.ts +0 -12
  126. package/lib/Signal/libsignal.d.ts +0 -5
  127. package/lib/Signal/lid-mapping.d.ts +0 -23
  128. package/lib/Socket/Client/index.d.ts +0 -3
  129. package/lib/Socket/Client/types.d.ts +0 -16
  130. package/lib/Socket/Client/websocket.d.ts +0 -13
  131. package/lib/Socket/business.d.ts +0 -217
  132. package/lib/Socket/chats.d.ts +0 -125
  133. package/lib/Socket/communities.d.ts +0 -273
  134. package/lib/Socket/groups.d.ts +0 -161
  135. package/lib/Socket/index.d.ts +0 -260
  136. package/lib/Socket/messages-recv.d.ts +0 -203
  137. package/lib/Socket/messages-send.d.ts +0 -199
  138. package/lib/Socket/mex.d.ts +0 -3
  139. package/lib/Socket/newsletter.d.ts +0 -170
  140. package/lib/Socket/socket.d.ts +0 -59
  141. package/lib/Types/Auth.d.ts +0 -117
  142. package/lib/Types/Bussines.d.ts +0 -25
  143. package/lib/Types/Call.d.ts +0 -15
  144. package/lib/Types/Chat.d.ts +0 -124
  145. package/lib/Types/Contact.d.ts +0 -26
  146. package/lib/Types/Events.d.ts +0 -256
  147. package/lib/Types/GroupMetadata.d.ts +0 -71
  148. package/lib/Types/Label.d.ts +0 -47
  149. package/lib/Types/LabelAssociation.d.ts +0 -30
  150. package/lib/Types/Message.d.ts +0 -320
  151. package/lib/Types/Mex.d.ts +0 -141
  152. package/lib/Types/Product.d.ts +0 -79
  153. package/lib/Types/Signal.d.ts +0 -87
  154. package/lib/Types/Socket.d.ts +0 -136
  155. package/lib/Types/State.d.ts +0 -97
  156. package/lib/Types/USync.d.ts +0 -26
  157. package/lib/Types/index.d.ts +0 -66
  158. package/lib/Utils/auth-utils.d.ts +0 -24
  159. package/lib/Utils/browser-utils.d.ts +0 -4
  160. package/lib/Utils/business.d.ts +0 -23
  161. package/lib/Utils/chat-utils.d.ts +0 -100
  162. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  163. package/lib/Utils/crypto.d.ts +0 -37
  164. package/lib/Utils/decode-wa-message.d.ts +0 -66
  165. package/lib/Utils/event-buffer.d.ts +0 -36
  166. package/lib/Utils/generics.d.ts +0 -92
  167. package/lib/Utils/history.d.ts +0 -24
  168. package/lib/Utils/identity-change-handler.d.ts +0 -44
  169. package/lib/Utils/identity-change-handler.js +0 -50
  170. package/lib/Utils/index.d.ts +0 -22
  171. package/lib/Utils/link-preview.d.ts +0 -21
  172. package/lib/Utils/logger.d.ts +0 -12
  173. package/lib/Utils/lt-hash.d.ts +0 -8
  174. package/lib/Utils/make-mutex.d.ts +0 -9
  175. package/lib/Utils/message-retry-manager.d.ts +0 -115
  176. package/lib/Utils/messages-media.d.ts +0 -133
  177. package/lib/Utils/messages.d.ts +0 -91
  178. package/lib/Utils/noise-handler.d.ts +0 -20
  179. package/lib/Utils/offline-node-processor.d.ts +0 -17
  180. package/lib/Utils/offline-node-processor.js +0 -40
  181. package/lib/Utils/pre-key-manager.d.ts +0 -28
  182. package/lib/Utils/process-message.d.ts +0 -60
  183. package/lib/Utils/reporting-utils.d.ts +0 -11
  184. package/lib/Utils/signal.d.ts +0 -47
  185. package/lib/Utils/stanza-ack.d.ts +0 -11
  186. package/lib/Utils/sync-action-utils.d.ts +0 -19
  187. package/lib/Utils/tc-token-utils.d.ts +0 -37
  188. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  189. package/lib/Utils/validate-connection.d.ts +0 -11
  190. package/lib/WABinary/constants.d.ts +0 -28
  191. package/lib/WABinary/decode.d.ts +0 -7
  192. package/lib/WABinary/encode.d.ts +0 -3
  193. package/lib/WABinary/generic-utils.d.ts +0 -15
  194. package/lib/WABinary/index.d.ts +0 -6
  195. package/lib/WABinary/jid-utils.d.ts +0 -48
  196. package/lib/WABinary/types.d.ts +0 -19
  197. package/lib/WAM/BinaryInfo.d.ts +0 -9
  198. package/lib/WAM/constants.d.ts +0 -40
  199. package/lib/WAM/encode.d.ts +0 -3
  200. package/lib/WAM/index.d.ts +0 -4
  201. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  202. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
  203. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
  204. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
  205. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  206. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
  207. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
  208. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  209. package/lib/WAUSync/USyncQuery.d.ts +0 -30
  210. package/lib/WAUSync/USyncUser.d.ts +0 -17
  211. package/lib/WAUSync/index.d.ts +0 -4
  212. package/lib/index.d.ts +0 -12
@@ -1,124 +0,0 @@
1
- import type { proto } from '../../WAProto/index.js';
2
- import type { AccountSettings } from './Auth.js';
3
- import type { QuickReplyAction } from './Bussines.js';
4
- import type { BufferedEventData } from './Events.js';
5
- import type { LabelActionBody } from './Label.js';
6
- import type { ChatLabelAssociationActionBody } from './LabelAssociation.js';
7
- import type { MessageLabelAssociationActionBody } from './LabelAssociation.js';
8
- import type { MinimalMessage, WAMessageKey } from './Message.js';
9
- /** privacy settings in WhatsApp Web */
10
- export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
11
- export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
12
- export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
13
- export type WAReadReceiptsValue = 'all' | 'none';
14
- export type WAPrivacyCallValue = 'all' | 'known';
15
- export type WAPrivacyMessagesValue = 'all' | 'contacts';
16
- /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
17
- export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
18
- export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
19
- export type WAPatchName = (typeof ALL_WA_PATCH_NAMES)[number];
20
- export interface PresenceData {
21
- lastKnownPresence: WAPresence;
22
- lastSeen?: number;
23
- groupOnlineCount?: number;
24
- }
25
- export type BotListInfo = {
26
- jid: string;
27
- personaId: string;
28
- };
29
- export type ChatMutation = {
30
- syncAction: proto.ISyncActionData;
31
- index: string[];
32
- };
33
- export type WAPatchCreate = {
34
- syncAction: proto.ISyncActionValue;
35
- index: string[];
36
- type: WAPatchName;
37
- apiVersion: number;
38
- operation: proto.SyncdMutation.SyncdOperation;
39
- };
40
- export type Chat = proto.IConversation & {
41
- /** unix timestamp of when the last message was received in the chat */
42
- lastMessageRecvTimestamp?: number;
43
- };
44
- export type ChatUpdate = Partial<Chat & {
45
- /**
46
- * if specified in the update,
47
- * the EV buffer will check if the condition gets fulfilled before applying the update
48
- * Right now, used to determine when to release an app state sync event
49
- *
50
- * @returns true, if the update should be applied;
51
- * false if it can be discarded;
52
- * undefined if the condition is not yet fulfilled
53
- * */
54
- conditional: (bufferedData: BufferedEventData) => boolean | undefined;
55
- /** last update time */
56
- timestamp?: number;
57
- }>;
58
- /**
59
- * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
60
- * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
61
- * */
62
- export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
63
- export type ChatModification = {
64
- archive: boolean;
65
- lastMessages: LastMessageList;
66
- } | {
67
- pushNameSetting: string;
68
- } | {
69
- pin: boolean;
70
- } | {
71
- /** mute for duration, or provide timestamp of mute to remove*/
72
- mute: number | null;
73
- } | {
74
- clear: boolean;
75
- lastMessages: LastMessageList;
76
- } | {
77
- deleteForMe: {
78
- deleteMedia: boolean;
79
- key: WAMessageKey;
80
- timestamp: number;
81
- };
82
- } | {
83
- star: {
84
- messages: {
85
- id: string;
86
- fromMe?: boolean;
87
- }[];
88
- star: boolean;
89
- };
90
- } | {
91
- markRead: boolean;
92
- lastMessages: LastMessageList;
93
- } | {
94
- delete: true;
95
- lastMessages: LastMessageList;
96
- } | {
97
- contact: proto.SyncActionValue.IContactAction | null;
98
- } | {
99
- disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
100
- } | {
101
- addLabel: LabelActionBody;
102
- } | {
103
- addChatLabel: ChatLabelAssociationActionBody;
104
- } | {
105
- removeChatLabel: ChatLabelAssociationActionBody;
106
- } | {
107
- addMessageLabel: MessageLabelAssociationActionBody;
108
- } | {
109
- removeMessageLabel: MessageLabelAssociationActionBody;
110
- } | {
111
- quickReply: QuickReplyAction;
112
- };
113
- export type InitialReceivedChatsState = {
114
- [jid: string]: {
115
- /** the last message received from the other party */
116
- lastMsgRecvTimestamp?: number;
117
- /** the absolute last message in the chat */
118
- lastMsgTimestamp: number;
119
- };
120
- };
121
- export type InitialAppStateSyncOptions = {
122
- accountSettings: AccountSettings;
123
- };
124
- //# sourceMappingURL=Chat.d.ts.map
@@ -1,26 +0,0 @@
1
- export interface Contact {
2
- /** ID either in lid or jid format (preferred) **/
3
- id: string;
4
- /** ID in LID format (@lid) **/
5
- lid?: string;
6
- /** ID in PN format (@s.whatsapp.net) **/
7
- phoneNumber?: string;
8
- /** name of the contact, you have saved on your WA */
9
- name?: string;
10
- /** name of the contact, the contact has set on their own on WA */
11
- notify?: string;
12
- /** username associated with this contact, when provided by WA */
13
- username?: string;
14
- /** I have no idea */
15
- verifiedName?: string;
16
- /**
17
- * Url of the profile picture of the contact
18
- *
19
- * 'changed' => if the profile picture has changed
20
- * null => if the profile picture has not been set (default profile picture)
21
- * any other string => url of the profile picture
22
- */
23
- imgUrl?: string | null;
24
- status?: string;
25
- }
26
- //# sourceMappingURL=Contact.d.ts.map
@@ -1,256 +0,0 @@
1
- import type { Boom } from '@hapi/boom';
2
- import { proto } from '../../WAProto/index.js';
3
- import type { AuthenticationCreds, LIDMapping } from './Auth.js';
4
- import type { WACallEvent } from './Call.js';
5
- import type { Chat, ChatUpdate, PresenceData } from './Chat.js';
6
- import type { Contact } from './Contact.js';
7
- import type { GroupMetadata, GroupParticipant, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata.js';
8
- import type { Label } from './Label.js';
9
- import type { LabelAssociation } from './LabelAssociation.js';
10
- import type { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message.js';
11
- import type { ConnectionState, NewChatMessageCapInfo } from './State.js';
12
- export type BaileysEventMap = {
13
- /** connection state has been updated -- WS closed, opened, connecting etc. */
14
- 'connection.update': Partial<ConnectionState>;
15
- /** credentials updated -- some metadata, keys or something */
16
- 'creds.update': Partial<AuthenticationCreds>;
17
- /** set chats (history sync), everything is reverse chronologically sorted */
18
- 'messaging-history.set': {
19
- chats: Chat[];
20
- contacts: Contact[];
21
- messages: WAMessage[];
22
- lidPnMappings?: LIDMapping[];
23
- isLatest?: boolean;
24
- progress?: number | null;
25
- syncType?: proto.HistorySync.HistorySyncType | null;
26
- pastParticipants?: proto.IPastParticipants[] | null;
27
- chunkOrder?: number | null;
28
- peerDataRequestSessionId?: string | null;
29
- };
30
- /** signals history sync milestones (completion or stall) per sync type */
31
- 'messaging-history.status': {
32
- /** which sync phase this status refers to */
33
- syncType: proto.HistorySync.HistorySyncType;
34
- /** the status of this sync phase */
35
- status: 'complete' | 'paused';
36
- /**
37
- * progress === 100 was received from the server.
38
- * when false, completion was inferred via timeout (no more chunks arriving).
39
- */
40
- explicit: boolean;
41
- };
42
- /** upsert chats */
43
- 'chats.upsert': Chat[];
44
- /** update the given chats */
45
- 'chats.update': ChatUpdate[];
46
- 'lid-mapping.update': LIDMapping;
47
- /** delete chats with given ID */
48
- 'chats.delete': string[];
49
- /** presence of contact in a chat updated */
50
- 'presence.update': {
51
- id: string;
52
- presences: {
53
- [participant: string]: PresenceData;
54
- };
55
- };
56
- 'contacts.upsert': Contact[];
57
- 'contacts.update': Partial<Contact>[];
58
- 'messages.delete': {
59
- keys: WAMessageKey[];
60
- } | {
61
- jid: string;
62
- all: true;
63
- };
64
- 'messages.update': WAMessageUpdate[];
65
- 'messages.media-update': {
66
- key: WAMessageKey;
67
- media?: {
68
- ciphertext: Uint8Array;
69
- iv: Uint8Array;
70
- };
71
- error?: Boom;
72
- }[];
73
- /**
74
- * add/update the given messages. If they were received while the connection was online,
75
- * the update will have type: "notify"
76
- * if requestId is provided, then the messages was received from the phone due to it being unavailable
77
- * */
78
- 'messages.upsert': {
79
- messages: WAMessage[];
80
- type: MessageUpsertType;
81
- requestId?: string;
82
- };
83
- /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
84
- 'messages.reaction': {
85
- key: WAMessageKey;
86
- reaction: proto.IReaction;
87
- }[];
88
- 'message-receipt.update': MessageUserReceiptUpdate[];
89
- 'groups.upsert': GroupMetadata[];
90
- 'groups.update': Partial<GroupMetadata>[];
91
- /** apply an action to participants in a group */
92
- 'group-participants.update': {
93
- id: string;
94
- author: string;
95
- authorPn?: string;
96
- authorUsername?: string;
97
- participants: GroupParticipant[];
98
- action: ParticipantAction;
99
- };
100
- 'group.join-request': {
101
- id: string;
102
- author: string;
103
- authorPn?: string;
104
- authorUsername?: string;
105
- participant: string;
106
- participantPn?: string;
107
- action: RequestJoinAction;
108
- method: RequestJoinMethod;
109
- };
110
- 'group.member-tag.update': {
111
- groupId: string;
112
- participant: string;
113
- participantAlt?: string;
114
- label: string;
115
- messageTimestamp?: number;
116
- };
117
- 'blocklist.set': {
118
- blocklist: string[];
119
- };
120
- 'blocklist.update': {
121
- blocklist: string[];
122
- type: 'add' | 'remove';
123
- };
124
- /** Receive an update on a call, including when the call was received, rejected, accepted */
125
- call: WACallEvent[];
126
- 'labels.edit': Label;
127
- 'labels.association': {
128
- association: LabelAssociation;
129
- type: 'add' | 'remove';
130
- };
131
- /** Newsletter-related events */
132
- 'newsletter.reaction': {
133
- id: string;
134
- server_id: string;
135
- reaction: {
136
- code?: string;
137
- count?: number;
138
- removed?: boolean;
139
- };
140
- };
141
- 'newsletter.view': {
142
- id: string;
143
- server_id: string;
144
- count: number;
145
- };
146
- 'newsletter-participants.update': {
147
- id: string;
148
- author: string;
149
- user: string;
150
- new_role: string;
151
- action: string;
152
- };
153
- 'newsletter-settings.update': {
154
- id: string;
155
- update: any;
156
- };
157
- 'message-capping.update': NewChatMessageCapInfo;
158
- /** Settings and actions sync events */
159
- 'chats.lock': {
160
- id: string;
161
- locked: boolean;
162
- };
163
- 'settings.update': {
164
- setting: 'unarchiveChats';
165
- value: boolean;
166
- } | {
167
- setting: 'locale';
168
- value: string;
169
- } | {
170
- setting: 'disableLinkPreviews';
171
- value: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
172
- } | {
173
- setting: 'timeFormat';
174
- value: proto.SyncActionValue.ITimeFormatAction;
175
- } | {
176
- setting: 'privacySettingRelayAllCalls';
177
- value: proto.SyncActionValue.IPrivacySettingRelayAllCalls;
178
- } | {
179
- setting: 'statusPrivacy';
180
- value: proto.SyncActionValue.IStatusPrivacyAction;
181
- } | {
182
- setting: 'notificationActivitySetting';
183
- value: proto.SyncActionValue.NotificationActivitySettingAction.NotificationActivitySetting;
184
- } | {
185
- setting: 'channelsPersonalisedRecommendation';
186
- value: proto.SyncActionValue.IPrivacySettingChannelsPersonalisedRecommendationAction;
187
- };
188
- };
189
- export type BufferedEventData = {
190
- historySets: {
191
- chats: {
192
- [jid: string]: Chat;
193
- };
194
- contacts: {
195
- [jid: string]: Contact;
196
- };
197
- messages: {
198
- [uqId: string]: WAMessage;
199
- };
200
- empty: boolean;
201
- isLatest: boolean;
202
- progress?: number | null;
203
- syncType?: proto.HistorySync.HistorySyncType;
204
- pastParticipants?: proto.IPastParticipants[];
205
- chunkOrder?: number | null;
206
- peerDataRequestSessionId?: string;
207
- };
208
- chatUpserts: {
209
- [jid: string]: Chat;
210
- };
211
- chatUpdates: {
212
- [jid: string]: ChatUpdate;
213
- };
214
- chatDeletes: Set<string>;
215
- contactUpserts: {
216
- [jid: string]: Contact;
217
- };
218
- contactUpdates: {
219
- [jid: string]: Partial<Contact>;
220
- };
221
- messageUpserts: {
222
- [key: string]: {
223
- type: MessageUpsertType;
224
- message: WAMessage;
225
- };
226
- };
227
- messageUpdates: {
228
- [key: string]: WAMessageUpdate;
229
- };
230
- messageDeletes: {
231
- [key: string]: WAMessageKey;
232
- };
233
- messageReactions: {
234
- [key: string]: {
235
- key: WAMessageKey;
236
- reactions: proto.IReaction[];
237
- };
238
- };
239
- messageReceipts: {
240
- [key: string]: {
241
- key: WAMessageKey;
242
- userReceipt: proto.IUserReceipt[];
243
- };
244
- };
245
- groupUpdates: {
246
- [jid: string]: Partial<GroupMetadata>;
247
- };
248
- };
249
- export type BaileysEvent = keyof BaileysEventMap;
250
- export interface BaileysEventEmitter {
251
- on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
252
- off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
253
- removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
254
- emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
255
- }
256
- //# sourceMappingURL=Events.d.ts.map
@@ -1,71 +0,0 @@
1
- import type { Contact } from './Contact.js';
2
- import type { WAMessageAddressingMode } from './Message.js';
3
- export type GroupParticipant = Contact & {
4
- isAdmin?: boolean;
5
- isSuperAdmin?: boolean;
6
- admin?: 'admin' | 'superadmin' | null;
7
- };
8
- export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
9
- export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
10
- export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
11
- export interface GroupMetadata {
12
- id: string;
13
- notify?: string;
14
- /** group uses 'lid' or 'pn' to send messages */
15
- addressingMode?: WAMessageAddressingMode;
16
- owner: string | undefined;
17
- ownerPn?: string | undefined;
18
- ownerUsername?: string | undefined;
19
- owner_country_code?: string | undefined;
20
- subject: string;
21
- /** group subject owner */
22
- subjectOwner?: string;
23
- subjectOwnerPn?: string;
24
- subjectOwnerUsername?: string;
25
- /** group subject modification date */
26
- subjectTime?: number;
27
- creation?: number;
28
- desc?: string;
29
- descOwner?: string;
30
- descOwnerPn?: string;
31
- descOwnerUsername?: string;
32
- descId?: string;
33
- descTime?: number;
34
- /** if this group is part of a community, it returns the jid of the community to which it belongs */
35
- linkedParent?: string;
36
- /** is set when the group only allows admins to change group settings */
37
- restrict?: boolean;
38
- /** is set when the group only allows admins to write messages */
39
- announce?: boolean;
40
- /** is set when the group also allows members to add participants */
41
- memberAddMode?: boolean;
42
- /** Request approval to join the group */
43
- joinApprovalMode?: boolean;
44
- /** is this a community */
45
- isCommunity?: boolean;
46
- /** is this the announce of a community */
47
- isCommunityAnnounce?: boolean;
48
- /** number of group participants */
49
- size?: number;
50
- participants: GroupParticipant[];
51
- ephemeralDuration?: number;
52
- inviteCode?: string;
53
- /** the person who added you to group or changed some setting in group */
54
- author?: string;
55
- authorPn?: string;
56
- authorUsername?: string;
57
- }
58
- export interface WAGroupCreateResponse {
59
- status: number;
60
- gid?: string;
61
- participants?: [{
62
- [key: string]: {};
63
- }];
64
- }
65
- export interface GroupModificationResponse {
66
- status: number;
67
- participants?: {
68
- [key: string]: {};
69
- };
70
- }
71
- //# sourceMappingURL=GroupMetadata.d.ts.map
@@ -1,47 +0,0 @@
1
- export interface Label {
2
- /** Label uniq ID */
3
- id: string;
4
- /** Label name */
5
- name: string;
6
- /** Label color ID */
7
- color: number;
8
- /** Is label has been deleted */
9
- deleted: boolean;
10
- /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
11
- predefinedId?: string;
12
- }
13
- export interface LabelActionBody {
14
- id: string;
15
- /** Label name */
16
- name?: string;
17
- /** Label color ID */
18
- color?: number;
19
- /** Is label has been deleted */
20
- deleted?: boolean;
21
- /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
22
- predefinedId?: number;
23
- }
24
- /** WhatsApp has 20 predefined colors */
25
- export declare enum LabelColor {
26
- Color1 = 0,
27
- Color2 = 1,
28
- Color3 = 2,
29
- Color4 = 3,
30
- Color5 = 4,
31
- Color6 = 5,
32
- Color7 = 6,
33
- Color8 = 7,
34
- Color9 = 8,
35
- Color10 = 9,
36
- Color11 = 10,
37
- Color12 = 11,
38
- Color13 = 12,
39
- Color14 = 13,
40
- Color15 = 14,
41
- Color16 = 15,
42
- Color17 = 16,
43
- Color18 = 17,
44
- Color19 = 18,
45
- Color20 = 19
46
- }
47
- //# sourceMappingURL=Label.d.ts.map
@@ -1,30 +0,0 @@
1
- /** Association type */
2
- export declare enum LabelAssociationType {
3
- Chat = "label_jid",
4
- Message = "label_message"
5
- }
6
- export type LabelAssociationTypes = `${LabelAssociationType}`;
7
- /** Association for chat */
8
- export interface ChatLabelAssociation {
9
- type: LabelAssociationType.Chat;
10
- chatId: string;
11
- labelId: string;
12
- }
13
- /** Association for message */
14
- export interface MessageLabelAssociation {
15
- type: LabelAssociationType.Message;
16
- chatId: string;
17
- messageId: string;
18
- labelId: string;
19
- }
20
- export type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation;
21
- /** Body for add/remove chat label association action */
22
- export interface ChatLabelAssociationActionBody {
23
- labelId: string;
24
- }
25
- /** body for add/remove message label association action */
26
- export interface MessageLabelAssociationActionBody {
27
- labelId: string;
28
- messageId: string;
29
- }
30
- //# sourceMappingURL=LabelAssociation.d.ts.map