@badzz88/baileys 8.3.0 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # WhatsApp Baileys Badzz
2
2
 
3
3
  <p align="center">
4
- <img src="https://d.top4top.io/p_3749w5rv01.jpg" alt="Thumbnail" />
4
+ <img src="https://b.top4top.io/p_3816tx02l1.jpg" alt="Thumbnail" />
5
5
  </p>
6
6
 
7
7
  WhatsApp Baileys is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
@@ -57,7 +57,7 @@ Send group status with version 2
57
57
  ```javascript
58
58
  await sock.sendMessage(target, {
59
59
  groupStatusMessage: {
60
- text: "Hello World"
60
+ text: "#BADZZNE"
61
61
  }
62
62
  });
63
63
  ```
@@ -68,8 +68,8 @@ Send multiple images in a single album message:
68
68
  ```javascript
69
69
  await sock.sendMessage(target, {
70
70
  albumMessage: [
71
- { image: cihuy, caption: "Foto pertama" },
72
- { image: { url: "URL IMAGE" }, caption: "Foto kedua" }
71
+ { image: cihuy, caption: "#BADZZNE" },
72
+ { image: { url: "URL IMAGE" }, caption: "#BADZZNE" }
73
73
  ]
74
74
  }, { quoted: m });
75
75
  ```
@@ -81,12 +81,12 @@ Create and send WhatsApp event invitations:
81
81
  await sock.sendMessage(target, {
82
82
  eventMessage: {
83
83
  isCanceled: false,
84
- name: "Hello World",
85
- description: "yume native",
84
+ name: "#BADZZNE",
85
+ description: "#BADZZNE",
86
86
  location: {
87
87
  degreesLatitude: 0,
88
88
  degreesLongitude: 0,
89
- name: "rowrrrr"
89
+ name: "#BADZZNE"
90
90
  },
91
91
  joinLink: "https://call.whatsapp.com/video/badzzne2",
92
92
  startTime: "1763019000",
@@ -102,14 +102,14 @@ Display poll results with vote counts:
102
102
  ```javascript
103
103
  await sock.sendMessage(target, {
104
104
  pollResultMessage: {
105
- name: "Hello World",
105
+ name: "#BADZZNE",
106
106
  pollVotes: [
107
107
  {
108
- optionName: "TEST 1",
108
+ optionName: "#BADZZNE",
109
109
  optionVoteCount: "112233"
110
110
  },
111
111
  {
112
- optionName: "TEST 2",
112
+ optionName: "#BADZZNE",
113
113
  optionVoteCount: "1"
114
114
  }
115
115
  ]
@@ -123,14 +123,14 @@ Send basic interactive messages with copy button functionality:
123
123
  ```javascript
124
124
  await sock.sendMessage(target, {
125
125
  interactiveMessage: {
126
- header: "Hello World",
127
- title: "Hello World",
126
+ header: "#BADZZNE",
127
+ title: "#BADZZNE",
128
128
  footer: "telegram: @badzzne2 ",
129
129
  buttons: [
130
130
  {
131
131
  name: "cta_copy",
132
132
  buttonParamsJson: JSON.stringify({
133
- display_text: "copy code",
133
+ display_text: "#BADZZNE",
134
134
  id: "123456789",
135
135
  copy_code: "ABC123XYZ"
136
136
  })
@@ -146,8 +146,8 @@ Send interactive messages with buttons, copy actions, and native flow features:
146
146
  ```javascript
147
147
  await sock.sendMessage(target, {
148
148
  interactiveMessage: {
149
- header: "Hello World",
150
- title: "Hello World",
149
+ header: "#BADZZNE",
150
+ title: "#BADZZNE",
151
151
  footer: "telegram: @badzzne2",
152
152
  image: { url: "https://example.com/image.jpg" },
153
153
  nativeFlowMessage: {
@@ -155,14 +155,14 @@ await sock.sendMessage(target, {
155
155
  limited_time_offer: {
156
156
  text: "idk hummmm?",
157
157
  url: "https://t.me/badzzne2",
158
- copy_code: "yume",
158
+ copy_code: "#BADZZNE",
159
159
  expiration_time: Date.now() * 999
160
160
  },
161
161
  bottom_sheet: {
162
162
  in_thread_buttons_limit: 2,
163
163
  divider_indices: [1, 2, 3, 4, 5, 999],
164
- list_title: "yume native",
165
- button_title: "yume native"
164
+ list_title: "#BADZZNE",
165
+ button_title: "#BADZZNE"
166
166
  },
167
167
  tap_target_configuration: {
168
168
  title: " X ",
@@ -188,7 +188,7 @@ await sock.sendMessage(target, {
188
188
  {
189
189
  name: "single_select",
190
190
  buttonParamsJson: JSON.stringify({
191
- title: "Hello World",
191
+ title: "#BADZZNE",
192
192
  sections: [
193
193
  {
194
194
  title: "title",
@@ -225,8 +225,8 @@ Send interactive messages with thumbnail image and copy button:
225
225
  ```javascript
226
226
  await sock.sendMessage(target, {
227
227
  interactiveMessage: {
228
- header: "Hello World",
229
- title: "Hello World",
228
+ header: "#BADZZNE",
229
+ title: "#BADZZNE",
230
230
  footer: "telegram: @badzzne2",
231
231
  image: { url: "https://example.com/image.jpg" },
232
232
  buttons: [
@@ -278,8 +278,8 @@ Send interactive messages with document from buffer (file system) - **Note: Docu
278
278
  ```javascript
279
279
  await sock.sendMessage(target, {
280
280
  interactiveMessage: {
281
- header: "Hello World",
282
- title: "Hello World",
281
+ header: "#BADZZNE",
282
+ title: "#BADZZNE",
283
283
  footer: "telegram: @badzzne2",
284
284
  document: fs.readFileSync("./package.json"),
285
285
  mimetype: "application/pdf",
@@ -291,8 +291,8 @@ await sock.sendMessage(target, {
291
291
  isForwarded: false
292
292
  },
293
293
  externalAdReply: {
294
- title: "shenń Bot",
295
- body: "anu team",
294
+ title: "#BADZZNE",
295
+ body: "#BADZZNE",
296
296
  mediaType: 3,
297
297
  thumbnailUrl: "https://example.com/image.jpg",
298
298
  mediaUrl: " X ",
@@ -320,8 +320,8 @@ Send interactive messages with document from buffer (file system) without contex
320
320
  ```javascript
321
321
  await sock.sendMessage(target, {
322
322
  interactiveMessage: {
323
- header: "Hello World",
324
- title: "Hello World",
323
+ header: "#BADZZNE",
324
+ title: "#BADZZNE",
325
325
  footer: "telegram: @badzzne2",
326
326
  document: fs.readFileSync("./package.json"),
327
327
  mimetype: "application/pdf",
@@ -0,0 +1,29 @@
1
+ const { readFileSync, writeFileSync } = require 'fs';
2
+ const { exit } = require 'process';
3
+
4
+ const filePath = './index.js';
5
+
6
+ try {
7
+ // Read the file
8
+ let content = readFileSync(filePath, 'utf8');
9
+
10
+ // Fix the import statement
11
+ content = content.replace(
12
+ /import \* as (\$protobuf) from/g,
13
+ 'import $1 from'
14
+ );
15
+
16
+ // add missing extension to the import
17
+ content = content.replace(
18
+ /(['"])protobufjs\/minimal(['"])/g,
19
+ '$1protobufjs/minimal.js$2'
20
+ );
21
+
22
+ // Write back
23
+ writeFileSync(filePath, content, 'utf8');
24
+
25
+ console.log(`✅ Fixed imports in ${filePath}`);
26
+ } catch (error) {
27
+ console.error(`❌ Error fixing imports: ${error.message}`);
28
+ exit(1);
29
+ }
@@ -2,10 +2,10 @@ const major = parseInt(process.versions.node.split('.')[0], 10);
2
2
 
3
3
  if (major < 20) {
4
4
  console.error(
5
- `\n Oops! Node.js kamu masih jadul 😅\n` +
5
+ `\n Woi!! Versi Node.js lu jadul‼️\n` +
6
6
  ` Versi sekarang : ${process.versions.node}\n` +
7
7
  ` Minimal : Node.js 20+\n\n` +
8
- ` Upgrade dulu ya biar lancar ✨\n`
8
+ ` Upgrade dulu biar ga error‼️\n`
9
9
  );
10
10
  process.exit(1);
11
11
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": [2, 3000, 1036335964]
3
- }
2
+ "version": [2, 3000, 1040735178]
3
+ }
package/lib/Signal/p ADDED
@@ -0,0 +1 @@
1
+
@@ -304,6 +304,14 @@ const makeChatsSocket = (config) => {
304
304
  return verifiedResults;
305
305
  }
306
306
  };
307
+ const toLid = async (jid) => {
308
+ const result = await onWhatsApp(jid);
309
+ let lidResult = result[0].lid;
310
+ if (!result[0].exist) {
311
+ lidResult = jid + "doesnt exist";
312
+ }
313
+ return lidResult
314
+ }
307
315
  const fetchStatus = async (jid) => {
308
316
  const [result] = await interactiveQuery([{ tag: 'user', attrs: { jid } }], { tag: 'status', attrs: {} });
309
317
  if (result) {
@@ -817,10 +825,17 @@ const makeChatsSocket = (config) => {
817
825
  }
818
826
  }, jid);
819
827
  };
820
- /**
821
- * queries need to be fired on connection open
822
- * help ensure parity with WA Web
823
- * */
828
+
829
+ const deleteChat = async (jid, key) => {
830
+ return chatModify({
831
+ delete: true,
832
+ lastMessages: [{
833
+ key: key,
834
+ messageTimestamp: Math.floor(Date.now() / 1000)
835
+ }],
836
+ }, jid);
837
+ }
838
+
824
839
  const executeInitQueries = async () => {
825
840
  await Promise.all([
826
841
  fetchProps(),
@@ -941,6 +956,7 @@ const makeChatsSocket = (config) => {
941
956
  presenceSubscribe,
942
957
  profilePictureUrl,
943
958
  onWhatsApp,
959
+ toLid,
944
960
  fetchBlocklist,
945
961
  fetchStatus,
946
962
  updateProfilePicture,
@@ -962,6 +978,7 @@ const makeChatsSocket = (config) => {
962
978
  addChatLabel,
963
979
  removeChatLabel,
964
980
  addMessageLabel,
981
+ deleteChat,
965
982
  checkStatusWA,
966
983
  removeMessageLabel,
967
984
  star
@@ -0,0 +1,180 @@
1
+ /// <reference types="node" />
2
+ import { proto } from '../../WAProto'
3
+ import { GroupMetadata, ParticipantAction, SocketConfig, NewsletterFetchedUpdate, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, SocketConfig, WAMediaUpload } from '../Types'
4
+ import { BinaryNode } from '../WABinary'
5
+
6
+ export interface CommunityMetadata extends GroupMetadata {
7
+ isCommunity: boolean
8
+ isCommunityAnnounce?: boolean
9
+ linkedParent?: string
10
+ joinApprovalMode?: boolean
11
+ }
12
+
13
+ export interface LinkedGroup {
14
+ id?: string
15
+ subject: string
16
+ creation?: number
17
+ owner?: string
18
+ size?: number
19
+ }
20
+
21
+ export interface CommunityLinkedGroups {
22
+ communityJid: string
23
+ isCommunity: boolean
24
+ linkedGroups: LinkedGroup[]
25
+ }
26
+
27
+ export declare const makeCommunitiesSocket: (config: SocketConfig) => {
28
+ communityMetadata: (jid: string) => Promise<CommunityMetadata>
29
+ communityCreate: (subject: string, body?: string) => Promise<GroupMetadata | null>
30
+ communityCreateGroup: (subject: string, participants: string[], parentCommunityJid: string) => Promise<GroupMetadata | null>
31
+ communityLeave: (id: string) => Promise<void>
32
+ communityUpdateSubject: (jid: string, subject: string) => Promise<void>
33
+ communityLinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>
34
+ communityUnlinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>
35
+ communityFetchLinkedGroups: (jid: string) => Promise<CommunityLinkedGroups>
36
+ communityRequestParticipantsList: (jid: string) => Promise<{ [key: string]: string }[]>
37
+ communityRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{ status: string, jid: string }[]>
38
+ communityParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{ status: string, jid: string, content: BinaryNode }[]>
39
+ communityUpdateDescription: (jid: string, description?: string) => Promise<void>
40
+ communityInviteCode: (jid: string) => Promise<string | undefined>
41
+ communityRevokeInvite: (jid: string) => Promise<string | undefined>
42
+ communityAcceptInvite: (code: string) => Promise<string | undefined>
43
+ /**
44
+ * revoke a v4 invite for someone
45
+ * @param communityJid community jid
46
+ * @param invitedJid jid of person you invited
47
+ * @returns true if successful
48
+ */
49
+ communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>
50
+ /**
51
+ * accept a CommunityInviteMessage
52
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
53
+ * @param inviteMessage the message to accept
54
+ */
55
+ communityAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>
56
+ communityGetInviteInfo: (code: string) => Promise<CommunityMetadata>
57
+ communityToggleEphemeral: (jid: string, ephemeralExpiration?: number) => Promise<void>
58
+ communitySettingUpdate: (jid: string, setting: 'locked' | 'announcement' | 'not_announcement' | 'unlocked') => Promise<void>
59
+ communityMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>
60
+ communityJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>
61
+ communityFetchAllParticipating: () => Promise<{ [_: string]: CommunityMetadata }>
62
+ processingMutex: {
63
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
64
+ }
65
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
66
+ duration: string;
67
+ }>;
68
+ newsletterReactionMode: (jid: string, mode: NewsletterReactionMode) => Promise<void>;
69
+ newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
70
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
71
+ newsletterUpdatePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
72
+ newsletterRemovePicture: (jid: string) => Promise<void>;
73
+ newsletterUnfollow: (jid: string) => Promise<void>;
74
+ newsletterFollow: (jid: string) => Promise<void>;
75
+ newsletterUnmute: (jid: string) => Promise<void>;
76
+ newsletterMute: (jid: string) => Promise<void>;
77
+ newsletterAction: (jid: string, type: 'follow' | 'unfollow' | 'mute' | 'unmute') => Promise<void>;
78
+ newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<NewsletterMetadata>;
79
+ newsletterMetadata: (type: 'invite' | 'jid', key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>;
80
+ newsletterAdminCount: (jid: string) => Promise<number>;
81
+ /**user is Lid, not Jid */
82
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
83
+ /**user is Lid, not Jid */
84
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
85
+ newsletterDelete: (jid: string) => Promise<void>;
86
+ /**if code wasn't passed, the reaction will be removed (if is reacted) */
87
+ newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
88
+ newsletterFetchMessages: (type: 'invite' | 'jid', key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>;
89
+ newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<NewsletterFetchedUpdate[]>;
90
+ groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
91
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
92
+ groupLeave: (id: string) => Promise<void>;
93
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
94
+ groupRequestParticipantsList: (jid: string) => Promise<{
95
+ [key: string]: string;
96
+ }[]>;
97
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
98
+ status: string;
99
+ jid: string;
100
+ }[]>;
101
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
102
+ status: string;
103
+ jid: string;
104
+ content: BinaryNode;
105
+ }[]>;
106
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
107
+ groupInviteCode: (jid: string) => Promise<string | undefined>;
108
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>;
109
+ groupAcceptInvite: (code: string) => Promise<string | undefined>;
110
+ groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
111
+ groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
112
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
113
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
114
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
115
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
116
+ groupFetchAllParticipating: () => Promise<{
117
+ [_: string]: import("../Types").GroupMetadata;
118
+ }>;
119
+ fetchPrivacySettings: (force?: boolean) => Promise<{ [_: string]: string }>
120
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import('../Types').MessageUpsertType) => Promise<void>
121
+ appPatch: (patchCreate: import('../Types').WAPatchCreate) => Promise<void>
122
+ sendPresenceUpdate: (type: import('../Types').WAPresence, toJid?: string) => Promise<void>
123
+ presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>
124
+ profilePictureUrl: (jid: string, type?: 'image' | 'preview', timeoutMs?: number) => Promise<string | undefined>
125
+ onWhatsApp: (...jids: string[]) => Promise<{ jid: string, exists: unknown, lid: unknown }[] | undefined>
126
+ fetchBlocklist: () => Promise<string[]>
127
+ fetchStatus: (jid: string) => Promise<{ status: string | undefined, setAt: Date } | undefined>
128
+ updateProfilePicture: (jid: string, content: import('../Types').WAMediaUpload) => Promise<void>
129
+ removeProfilePicture: (jid: string) => Promise<void>
130
+ updateProfileStatus: (status: string) => Promise<void>
131
+ updateProfileName: (name: string) => Promise<void>
132
+ updateBlockStatus: (jid: string, action: 'block' | 'unblock') => Promise<void>
133
+ updateLastSeenPrivacy: (value: import('../Types').WAPrivacyValue) => Promise<void>
134
+ updateOnlinePrivacy: (value: import('../Types').WAPrivacyOnlineValue) => Promise<void>
135
+ updateProfilePicturePrivacy: (value: import('../Types').WAPrivacyValue) => Promise<void>
136
+ updateStatusPrivacy: (value: import('../Types').WAPrivacyValue) => Promise<void>
137
+ updateReadReceiptsPrivacy: (value: import('../Types').WAReadReceiptsValue) => Promise<void>
138
+ updateGroupsAddPrivacy: (value: import('../Types').WAPrivacyValue) => Promise<void>
139
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
140
+ getBusinessProfile: (jid: string) => Promise<void | import('../Types').WABusinessProfile>
141
+ resyncAppState: (collections: readonly ('critical_block' | 'critical_unblock_low' | 'regular_high' | 'regular_low' | 'regular')[], isInitialSync: boolean) => Promise<void>
142
+ chatModify: (mod: import('../Types').ChatModification, jid: string) => Promise<void>
143
+ cleanDirtyBits: (type: 'account_sync' | 'groups', fromTimestamp?: string | number) => Promise<void>
144
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
145
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
146
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
147
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
148
+ star: (jid: string, messages: { id: string, fromMe?: boolean }[], star: boolean) => Promise<void>
149
+ type: 'md'
150
+ ws: any
151
+ ev: import('../Types').BaileysEventEmitter & {
152
+ process(handler: (events: Partial<import('../Types').BaileysEventMap>) => void | Promise<void>): () => void
153
+ buffer(): void
154
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
155
+ flush(force?: boolean): boolean
156
+ isBuffering(): boolean
157
+ }
158
+ authState: {
159
+ creds: import('../Types').AuthenticationCreds
160
+ keys: import('../Types').SignalKeyStoreWithTransaction
161
+ }
162
+ signalRepository: import('../Types').SignalRepository
163
+ user: import('../Types').Contact | undefined
164
+ generateMessageTag: () => string
165
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>
166
+ waitForMessage: <T>(msgId: string, timeoutMs?: number) => Promise<T>
167
+ waitForSocketOpen: () => Promise<void>
168
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
169
+ sendNode: (frame: BinaryNode) => Promise<void>
170
+ logout: (msg?: string) => Promise<void>
171
+ end: (error: Error | undefined) => void
172
+ onUnexpectedError: (err: Error | import('@hapi/boom').Boom, msg: string) => void
173
+ uploadPreKeys: (count?: number) => Promise<void>
174
+ uploadPreKeysToServerIfRequired: () => Promise<void>
175
+ requestPairingCode: (phoneNumber: string) => Promise<string>
176
+ waitForConnectionUpdate: (check: (u: Partial<import('../Types').ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>
177
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
178
+ }
179
+
180
+ export declare const extractCommunityMetadata: (result: BinaryNode) => CommunityMetadata