@poucode/baileys 1.0.2 → 2.0.1
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 +19 -0
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/chats.js +5 -0
- package/lib/Socket/graphql.js +716 -0
- package/lib/Socket/index.js +10 -2
- package/lib/Socket/interop.js +463 -0
- package/lib/Socket/luxu.js +1 -1
- package/lib/Socket/message-builder.js +475 -0
- package/lib/Socket/messages-send.js +59 -11
- package/lib/Socket/privacy.js +318 -0
- package/lib/Store/make-in-memory-store.js +47 -1
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/messages-media.js +82 -0
- package/lib/Utils/messages.js +137 -3
- package/lib/Utils/sticker.js +133 -0
- package/lib/Utils/use-sqlite-auth-state.js +162 -0
- package/lib/WAUSync/Protocols/BotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/LIDProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +53 -50
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +56 -52
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +29 -25
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +58 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -36
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +26 -23
- package/lib/WAUSync/Protocols/index.js +12 -5
- package/lib/WAUSync/USyncQuery.js +150 -96
- package/lib/WAUSync/USyncUser.js +55 -29
- package/lib/WAUSync/index.js +3 -3
- package/package.json +5 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -50
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -28
package/lib/WAUSync/USyncUser.js
CHANGED
|
@@ -1,30 +1,56 @@
|
|
|
1
1
|
export class USyncUser {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
2
|
+
withId(id) {
|
|
3
|
+
this.id = id
|
|
4
|
+
return this
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
withLid(lid) {
|
|
8
|
+
this.lid = lid
|
|
9
|
+
return this
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
withPhone(phone) {
|
|
13
|
+
this.phone = phone
|
|
14
|
+
return this
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
withUsername(username) {
|
|
18
|
+
this.username = username
|
|
19
|
+
return this
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
withUsernameKey(usernameKey) {
|
|
23
|
+
this.usernameKey = usernameKey
|
|
24
|
+
return this
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
withType(type) {
|
|
28
|
+
this.type = type
|
|
29
|
+
return this
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
withPersonaId(personaId) {
|
|
33
|
+
this.personaId = personaId
|
|
34
|
+
return this
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
withPictureId(pictureId) {
|
|
38
|
+
this.pictureId = pictureId
|
|
39
|
+
return this
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
withVerifiedNameSerial(serial) {
|
|
43
|
+
this.verifiedNameSerial = serial
|
|
44
|
+
return this
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
withBusinessProfileTag(tag) {
|
|
48
|
+
this.businessProfileTag = tag
|
|
49
|
+
return this
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
withSidelistDelete(del = true) {
|
|
53
|
+
this.sidelistDelete = del
|
|
54
|
+
return this
|
|
55
|
+
}
|
|
56
|
+
}
|
package/lib/WAUSync/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Protocols/index.js'
|
|
2
|
-
export * from './USyncQuery.js'
|
|
3
|
-
export * from './USyncUser.js'
|
|
1
|
+
export * from './Protocols/index.js'
|
|
2
|
+
export * from './USyncQuery.js'
|
|
3
|
+
export * from './USyncUser.js'
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poucode/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"description": "WaBail — PouCode fork of Baileys: WhatsApp Web WebSocket library with merged extra socket layers (privacy, interop, GraphQL, message builder), sticker packs and SQLite auth state",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"poucode",
|
|
8
8
|
"baileys",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"whatsapp-api",
|
|
11
11
|
"whatsapp-web",
|
|
12
12
|
"wa-bot",
|
|
13
|
-
"whatsapp bot"
|
|
13
|
+
"whatsapp bot",
|
|
14
|
+
"wabail",
|
|
15
|
+
"whatsapp-bot"
|
|
14
16
|
],
|
|
15
17
|
"homepage": "https://github.com/pou-code/WaBail",
|
|
16
18
|
"repository": {
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString } from '../../WABinary/index.js';
|
|
2
|
-
import { USyncUser } from '../USyncUser.js';
|
|
3
|
-
export class USyncBotProfileProtocol {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.name = 'bot';
|
|
6
|
-
}
|
|
7
|
-
getQueryElement() {
|
|
8
|
-
return {
|
|
9
|
-
tag: 'bot',
|
|
10
|
-
attrs: {},
|
|
11
|
-
content: [{ tag: 'profile', attrs: { v: '1' } }]
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
getUserElement(user) {
|
|
15
|
-
return {
|
|
16
|
-
tag: 'bot',
|
|
17
|
-
attrs: {},
|
|
18
|
-
content: [{ tag: 'profile', attrs: { persona_id: user.personaId } }]
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
parser(node) {
|
|
22
|
-
const botNode = getBinaryNodeChild(node, 'bot');
|
|
23
|
-
const profile = getBinaryNodeChild(botNode, 'profile');
|
|
24
|
-
const commandsNode = getBinaryNodeChild(profile, 'commands');
|
|
25
|
-
const promptsNode = getBinaryNodeChild(profile, 'prompts');
|
|
26
|
-
const commands = [];
|
|
27
|
-
const prompts = [];
|
|
28
|
-
for (const command of getBinaryNodeChildren(commandsNode, 'command')) {
|
|
29
|
-
commands.push({
|
|
30
|
-
name: getBinaryNodeChildString(command, 'name'),
|
|
31
|
-
description: getBinaryNodeChildString(command, 'description')
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
for (const prompt of getBinaryNodeChildren(promptsNode, 'prompt')) {
|
|
35
|
-
prompts.push(`${getBinaryNodeChildString(prompt, 'emoji')} ${getBinaryNodeChildString(prompt, 'text')}`);
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
isDefault: !!getBinaryNodeChild(profile, 'default'),
|
|
39
|
-
jid: node.attrs.jid,
|
|
40
|
-
name: getBinaryNodeChildString(profile, 'name'),
|
|
41
|
-
attributes: getBinaryNodeChildString(profile, 'attributes'),
|
|
42
|
-
description: getBinaryNodeChildString(profile, 'description'),
|
|
43
|
-
category: getBinaryNodeChildString(profile, 'category'),
|
|
44
|
-
personaId: profile.attrs['persona_id'],
|
|
45
|
-
commandsDescription: getBinaryNodeChildString(commandsNode, 'description'),
|
|
46
|
-
commands,
|
|
47
|
-
prompts
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export class USyncLIDProtocol {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.name = 'lid';
|
|
4
|
-
}
|
|
5
|
-
getQueryElement() {
|
|
6
|
-
return {
|
|
7
|
-
tag: 'lid',
|
|
8
|
-
attrs: {}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
getUserElement(user) {
|
|
12
|
-
if (user.lid) {
|
|
13
|
-
return {
|
|
14
|
-
tag: 'lid',
|
|
15
|
-
attrs: { jid: user.lid }
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
parser(node) {
|
|
23
|
-
if (node.tag === 'lid') {
|
|
24
|
-
return node.attrs.val;
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
}
|